diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java index 37903a96d9..d18702a7d0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java @@ -96,6 +96,7 @@ public class HarParser extends HarAbstractParser { if (harRequest != null) { MsHTTPSamplerProxy request = super.buildRequest(reqName, url, harRequest.method, null); + request.setFollowRedirects(true); ApiDefinitionWithBLOBs apiDefinition = super.buildApiDefinition(request.getId(), reqName, url, harRequest.method, importRequest); parseParameters(harRequest, request); parseRequestBody(harRequest, request.getBody()); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java index f49f8bbe3c..4ff7637c67 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java @@ -128,6 +128,7 @@ public class Swagger2Parser extends SwaggerAbstractParser { for (HttpMethod method : httpMethods) { Operation operation = operationMap.get(method); MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name()); + request.setFollowRedirects(true); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest); parseParameters(operation, request); addBodyHeader(request); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java index 3fb887a057..5d9d43c212 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java @@ -144,6 +144,7 @@ public class Swagger3Parser extends SwaggerAbstractParser { Operation operation = operationsMap.get(method); if (operation != null) { MsHTTPSamplerProxy request = buildRequest(operation, pathName, method); + request.setFollowRedirects(true); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method, importRequest); apiDefinition.setDescription(operation.getDescription()); parseParameters(operation, request); diff --git a/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java b/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java index 957303a401..3ac7f6cf4f 100644 --- a/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java @@ -161,7 +161,6 @@ public abstract class ApiImportAbstractParser implements ApiImportParser { request.setHeaders(new ArrayList<>()); request.setArguments(new ArrayList<>()); request.setRest(new ArrayList<>()); - request.setFollowRedirects(true); Body body = new Body(); body.initKvs(); body.initBinary();