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 22c78ad384..702d3326a4 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 @@ -272,10 +272,14 @@ public class MsHTTPSamplerProxy extends MsTestElement { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(path); stringBuffer.append("?"); - this.getArguments().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).forEach(keyValue -> - stringBuffer.append(keyValue.getName()).append("=").append(keyValue.getValue() != null && keyValue.getValue().startsWith("@") ? - ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue()).append("&") - ); + this.getArguments().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).forEach(keyValue -> { + stringBuffer.append(keyValue.getName()); + if (keyValue.getValue() != null) { + stringBuffer.append("=").append(keyValue.getValue().startsWith("@") ? + ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue()); + } + stringBuffer.append("&"); + }); return stringBuffer.substring(0, stringBuffer.length() - 1); } 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 85153d2bcd..9cb1e08033 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 @@ -57,7 +57,7 @@ public class KeyValue { } public boolean isValid() { - return ((StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) || "JSON-SCHEMA".equals(type)) && !StringUtils.equalsIgnoreCase(type, "file"); + return (StringUtils.isNotBlank(name) || "JSON-SCHEMA".equals(type)) && !StringUtils.equalsIgnoreCase(type, "file"); } public boolean isFile() {