From 2ff9d70ab7cd28616203cd0f1585ab988156fa4a Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Sun, 28 Apr 2024 19:14:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/parser/api/PostmanAbstractParserParser.java | 8 ++++++++ .../io/metersphere/api/parser/api/Swagger3Parser.java | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/PostmanAbstractParserParser.java b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/PostmanAbstractParserParser.java index a5c970abf8..4422217cb0 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/PostmanAbstractParserParser.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/PostmanAbstractParserParser.java @@ -10,6 +10,7 @@ import io.metersphere.api.dto.ApiFile; import io.metersphere.api.dto.converter.ApiDefinitionImportDetail; import io.metersphere.api.dto.definition.HttpResponse; import io.metersphere.api.dto.request.ImportRequest; +import io.metersphere.api.dto.request.MsCommonElement; import io.metersphere.api.dto.request.http.MsHTTPElement; import io.metersphere.api.dto.request.http.MsHeader; import io.metersphere.api.dto.request.http.QueryParam; @@ -22,6 +23,7 @@ import io.metersphere.api.parser.api.postman.PostmanItem; import io.metersphere.api.parser.api.postman.PostmanKeyValue; import io.metersphere.api.parser.api.postman.PostmanRequest; import io.metersphere.api.parser.api.postman.PostmanResponse; +import io.metersphere.plugin.api.spi.AbstractMsTestElement; import io.metersphere.project.dto.environment.auth.BasicAuth; import io.metersphere.project.dto.environment.auth.DigestAuth; import io.metersphere.project.dto.environment.auth.HTTPAuthConfig; @@ -31,6 +33,7 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; public abstract class PostmanAbstractParserParser extends ApiImportAbstractParser { @@ -89,6 +92,11 @@ public abstract class PostmanAbstractParserParser extends ApiImportAbstractPa BooleanUtils.isTrue(protocolProfileBehavior.getFollowRedirects())); request.getOtherConfig().setAutoRedirects(!request.getOtherConfig().getFollowRedirects()); + //构造 children + LinkedList children = new LinkedList<>(); + children.add(new MsCommonElement()); + request.setChildren(children); + detail.setRequest(request); //设置response diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/Swagger3Parser.java b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/Swagger3Parser.java index a6b19d8268..295f8cbfa2 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/Swagger3Parser.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/Swagger3Parser.java @@ -226,6 +226,10 @@ public class Swagger3Parser extends ApiImportAbstractParser {