From db997d75780d5db553178d37de315403152d2e1b Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 7 Apr 2021 16:41:55 +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=E5=AF=BC=E5=85=A5jmx=20=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96body=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/automation/parse/MsJmeterParser.java | 6 ++++++ .../src/main/java/io/metersphere/api/dto/scenario/Body.java | 6 ++++++ 2 files changed, 12 insertions(+) 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());