From 2bea883de70acb1a5581a3302d8ada88877ee9a8 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 7 Feb 2023 15:26:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dswagger=E3=80=81postman=E3=80=81har=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=AF=BC=E5=85=A5=E7=9A=84=E6=8E=A5=E5=8F=A3=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1022544 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001022544 --- .../io/metersphere/api/parse/PostmanAbstractParserParser.java | 2 ++ .../src/main/java/io/metersphere/api/parse/api/HarParser.java | 2 ++ .../main/java/io/metersphere/api/parse/api/Swagger2Parser.java | 2 ++ .../main/java/io/metersphere/api/parse/api/Swagger3Parser.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java index 67af247760..78ae5d834e 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java @@ -55,6 +55,8 @@ public abstract class PostmanAbstractParserParser extends ApiImportAbstractPa } else { request.setFollowRedirects(true); } + request.setResponseTimeout("60000"); + request.setConnectTimeout("60000"); return request; } diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/api/HarParser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/api/HarParser.java index 56f28591d2..8edb4cd74e 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/api/HarParser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/api/HarParser.java @@ -103,6 +103,8 @@ public class HarParser extends HarAbstractParser { if (harRequest != null) { MsHTTPSamplerProxy request = super.buildRequest(reqName, url, harRequest.method, null); request.setFollowRedirects(true); + request.setResponseTimeout("60000"); + request.setConnectTimeout("60000"); ApiDefinitionWithBLOBs apiDefinition = super.buildApiDefinition(request.getId(), reqName, url, harRequest.method, importRequest); parseParameters(harRequest, request); parseRequestBody(harRequest, request.getBody()); diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java index ea7db5d677..6bb30a49f4 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java @@ -140,6 +140,8 @@ public class Swagger2Parser extends SwaggerAbstractParser { Operation operation = operationMap.get(method); MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name()); request.setFollowRedirects(true); + request.setResponseTimeout("60000"); + request.setConnectTimeout("60000"); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest); apiDefinition.setDescription(operation.getDescription()); parseParameters(operation, request); diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java index 3e75440dd8..9fb259d9b2 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java @@ -151,6 +151,8 @@ public class Swagger3Parser extends SwaggerAbstractParser { if (operation != null) { MsHTTPSamplerProxy request = buildRequest(operation, pathName, method); request.setFollowRedirects(true); + request.setResponseTimeout("60000"); + request.setConnectTimeout("60000"); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method, importRequest); apiDefinition.setDescription(operation.getDescription()); parseParameters(operation, request);