From cfa70bb6223379fc95c507d206efaa1fd577b878 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 7 Jan 2021 10:47:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8Dhttp=20=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=E6=97=A0=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=20=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/definition/request/sampler/MsHTTPSamplerProxy.java | 2 +- .../src/main/java/io/metersphere/api/dto/scenario/KeyValue.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index dbfa8b8173..967bedb446 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -265,7 +265,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { private Arguments httpArguments(List list) { Arguments arguments = new Arguments(); list.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> { - HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), keyValue.getValue() != null && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue()); + HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), StringUtils.isNotEmpty(keyValue.getValue()) && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue()); httpArgument.setAlwaysEncoded(keyValue.isEncode()); if (StringUtils.isNotBlank(keyValue.getContentType())) { httpArgument.setContentType(keyValue.getContentType()); diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/KeyValue.java b/backend/src/main/java/io/metersphere/api/dto/scenario/KeyValue.java index 2d5191ac4e..5a7e978ac6 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/KeyValue.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/KeyValue.java @@ -49,7 +49,7 @@ public class KeyValue { } public boolean isValid() { - return (StringUtils.isNotBlank(name) || StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file"); + return (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file"); } public boolean isFile() {