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 {