diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java index 6ca5d6d0fc..0320e452b0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsJmeterParser.java @@ -198,6 +198,12 @@ public class MsJmeterParser extends ApiImportAbstractParser { samplerProxy.setArguments(new ArrayList() {{ this.add(new KeyValue()); }}); + // 初始化body + Body body = new Body(); + body.init(); + body.initKvs(); + body.initBinary(); + samplerProxy.setBody(body); if (source != null && source.getHTTPFiles().length > 0) { samplerProxy.getBody().initBinary(); samplerProxy.getBody().setType(Body.FORM_DATA); 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 4ae0e7d279..b45d66a849 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 @@ -116,6 +116,12 @@ public class Body { return StringUtils.equals(type, XML); } + public void init() { + this.type = ""; + this.raw = ""; + this.format = ""; + } + public void initKvs() { this.kvs = new ArrayList<>(); this.kvs.add(new KeyValue());