fix(接口测试): swagger和har默认开启跟随重定向其他格式不变

--user=郭雨琦
--bug=1014715
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014715
This commit is contained in:
guoyuqi 2022-07-07 10:45:57 +08:00 committed by xiaomeinvG
parent a2debaf981
commit 3cce3d0430
4 changed files with 3 additions and 1 deletions

View File

@ -106,6 +106,7 @@ public class HarParser extends HarAbstractParser {
if (harRequest != null) { if (harRequest != null) {
MsHTTPSamplerProxy request = super.buildRequest(reqName, url, harRequest.method, null); MsHTTPSamplerProxy request = super.buildRequest(reqName, url, harRequest.method, null);
request.setFollowRedirects(true);
ApiDefinitionWithBLOBs apiDefinition = super.buildApiDefinition(request.getId(), reqName, url, harRequest.method, importRequest); ApiDefinitionWithBLOBs apiDefinition = super.buildApiDefinition(request.getId(), reqName, url, harRequest.method, importRequest);
parseParameters(harRequest, request); parseParameters(harRequest, request);
parseRequestBody(harRequest, request.getBody()); parseRequestBody(harRequest, request.getBody());

View File

@ -128,6 +128,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
for (HttpMethod method : httpMethods) { for (HttpMethod method : httpMethods) {
Operation operation = operationMap.get(method); Operation operation = operationMap.get(method);
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name()); MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name());
request.setFollowRedirects(true);
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest);
parseParameters(operation, request); parseParameters(operation, request);
addBodyHeader(request); addBodyHeader(request);

View File

@ -144,6 +144,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
Operation operation = operationsMap.get(method); Operation operation = operationsMap.get(method);
if (operation != null) { if (operation != null) {
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method); MsHTTPSamplerProxy request = buildRequest(operation, pathName, method);
request.setFollowRedirects(true);
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method, importRequest); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method, importRequest);
apiDefinition.setDescription(operation.getDescription()); apiDefinition.setDescription(operation.getDescription());
parseParameters(operation, request); parseParameters(operation, request);

View File

@ -161,7 +161,6 @@ public abstract class ApiImportAbstractParser<T> implements ApiImportParser<T> {
request.setHeaders(new ArrayList<>()); request.setHeaders(new ArrayList<>());
request.setArguments(new ArrayList<>()); request.setArguments(new ArrayList<>());
request.setRest(new ArrayList<>()); request.setRest(new ArrayList<>());
request.setFollowRedirects(true);
Body body = new Body(); Body body = new Body();
body.initKvs(); body.initKvs();
body.initBinary(); body.initBinary();