From c9fd6fd6dce3a4327aca63f177f73781c91710ae Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 5 Jul 2021 17:01:49 +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=E6=96=87=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF=20#1004805?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/automation/parse/MsJmeterParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 4c4fee7a36..f5a4c92edd 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 @@ -240,7 +240,9 @@ public class MsJmeterParser extends ApiImportAbstractParser { Body body = new Body(); body.init(); body.initKvs(); + body.getKvs().clear(); body.initBinary(); + body.getBinary().clear(); samplerProxy.setBody(body); if (source != null && source.getHTTPFiles().length > 0) { samplerProxy.getBody().initBinary(); @@ -278,7 +280,7 @@ public class MsJmeterParser extends ApiImportAbstractParser { samplerProxy.getBody().setRaw(v); }); samplerProxy.getBody().initKvs(); - } else if (StringUtils.isNotEmpty(bodyType)) { + } else if (StringUtils.isNotEmpty(bodyType) || (source.getMethod().equalsIgnoreCase("POST") && source.getArguments().getArgumentsAsMap().size() > 0)) { samplerProxy.getBody().setType(Body.WWW_FROM); source.getArguments().getArgumentsAsMap().forEach((k, v) -> { KeyValue keyValue = new KeyValue(k, v); @@ -309,6 +311,8 @@ public class MsJmeterParser extends ApiImportAbstractParser { } samplerProxy.setId(UUID.randomUUID().toString()); samplerProxy.setType("HTTPSamplerProxy"); + body.getKvs().add(new KeyValue()); + body.getBinary().add(new KeyValue()); } catch (Exception e) { e.printStackTrace();