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) {