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 ba4ba8c637..9f3492ed91 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 @@ -237,7 +237,10 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setDoMultipart(true); } if (CollectionUtils.isNotEmpty(bodyParams)) { - sampler.setArguments(httpArguments(bodyParams)); + Arguments arguments = httpArguments(bodyParams); + if (arguments != null && !arguments.getArguments().isEmpty()) { + sampler.setArguments(arguments); + } } } diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java index 825d34bdcf..13e67872de 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java @@ -71,12 +71,14 @@ public class Body { sampler.setDoMultipart(true); } } else { - parseJonBodyMock(); - KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true); - sampler.setPostBodyRaw(true); - keyValue.setEnable(true); - keyValue.setUrlEncode(false); - body.add(keyValue); + if(StringUtils.isNotEmpty(this.getRaw()) || this.getJsonSchema()!= null ) { + parseJonBodyMock(); + KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true); + sampler.setPostBodyRaw(true); + keyValue.setEnable(true); + keyValue.setUrlEncode(false); + body.add(keyValue); + } } return body; }