From 25e03d010eeb3815d2c26dd4934c0bce5738a9b0 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 7 May 2021 10:06:15 +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=EF=BC=8C=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8C=B9=E9=85=8D=E7=9A=84=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=A4=B4=E4=B8=8D=E8=B5=B7=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BF=AE=E5=A4=8D=E6=80=9D=E7=BB=B4?= =?UTF-8?q?=E5=AF=BC=E5=9B=BE=E5=AF=BC=E5=85=A5=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/sampler/MsHTTPSamplerProxy.java | 26 ++----------------- .../io/metersphere/xmind/XmindCaseParser.java | 4 +-- 2 files changed, 4 insertions(+), 26 deletions(-) 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 6bede2597f..afd7e8a470 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 @@ -505,11 +505,8 @@ public class MsHTTPSamplerProxy extends MsTestElement { } } // HTTP 环境中请求头 - if (httpConfig != null) { - Arguments arguments = arguments(httpConfig.getHeaders()); - if (arguments != null) { - tree.add(ParameterConfig.valueSupposeMock(arguments)); - } + if (httpConfig != null && CollectionUtils.isNotEmpty(httpConfig.getHeaders())) { + setHeader(tree, httpConfig.getHeaders()); } return httpConfig; } @@ -538,25 +535,6 @@ public class MsHTTPSamplerProxy extends MsTestElement { return null; } - private Arguments arguments(List headers) { - Arguments arguments = new Arguments(); - arguments.setEnabled(true); - arguments.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Arguments"); - arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName()); - arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel")); - - // HTTP放到请求中,按照域名匹配 - if (CollectionUtils.isNotEmpty(headers)) { - headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> - arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=") - ); - } - if (arguments.getArguments() != null && arguments.getArguments().size() > 0) { - return arguments; - } - return null; - } - private boolean isRest() { return this.getRest().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).toArray().length > 0; } diff --git a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index d9d672385a..5409fbd6a4 100644 --- a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -201,7 +201,7 @@ public class XmindCaseParser { item.setParent(parent); this.formatTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null); } else { - String nodePath = parent.getPath() + "/" + item.getTitle(); + String nodePath = parent.getPath().trim() + "/" + item.getTitle().trim(); item.setPath(nodePath); item.setParent(parent); if (item.getChildren() != null && CollectionUtils.isNotEmpty(item.getChildren().getAttached())) { @@ -286,7 +286,7 @@ public class XmindCaseParser { // 用例名称 String name = title.replace(tcArrs[0] + ":", "").replace(tcArrs[0] + ":", ""); testCase.setName(name); - testCase.setNodePath(nodePath); + testCase.setNodePath(nodePath.trim()); // 用例等级和用例性质处理 if (tcArrs[0].indexOf("-") != -1) {