From c43a258780916d05ff2c779e8ccf5ff25b623a67 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 25 Mar 2021 17:53:26 +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=8Djmx=E5=AF=BC=E5=87=BA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=BD=93=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/automation/parse/MsJmeterParser.java | 10 ++++++++-- .../java/io/metersphere/api/dto/scenario/Body.java | 1 + frontend/src/business/components/xpack | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) 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 914ef1eef0..0ce4456848 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 @@ -137,7 +137,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { HTTPSamplerProxy source = (HTTPSamplerProxy) key; BeanUtils.copyBean(samplerProxy, source); if (source != null && source.getHTTPFiles().length > 0) { - samplerProxy.getBody().setBinary(new ArrayList<>()); + samplerProxy.getBody().initBinary(); samplerProxy.getBody().setType(Body.FORM_DATA); List keyValues = new LinkedList<>(); for (HTTPFileArg arg : source.getHTTPFiles()) { @@ -153,7 +153,12 @@ public class MsJmeterParser extends ApiImportAbstractParser { keyValue.setFiles(files); keyValues.add(keyValue); } - samplerProxy.getBody().setKvs(keyValues); + if (source.getPostBodyRaw() && CollectionUtils.isNotEmpty(keyValues)) { + samplerProxy.getBody().setType(Body.RAW); + samplerProxy.getBody().setRaw(keyValues.get(0).getValue()); + } else { + samplerProxy.getBody().setKvs(keyValues); + } } samplerProxy.setProtocol(RequestType.HTTP); samplerProxy.setPort(source.getPort() + ""); @@ -173,6 +178,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { samplerProxy.setArguments(keyValues); } } + samplerProxy.getBody().initBinary(); } samplerProxy.setPath(""); samplerProxy.setMethod(source.getMethod()); 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 f3f484b747..cabfccc0c4 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 @@ -74,6 +74,7 @@ public class Body { } } KeyValue keyValue = new KeyValue("", "JSON-SCHEMA", this.getRaw(), true, true); + sampler.setPostBodyRaw(true); keyValue.setEnable(true); keyValue.setEncode(false); body.add(keyValue); diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 2115bd28a9..07951ba17a 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 2115bd28a90854d2b6276a90878934715498c584 +Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd