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 48824fe9f9..d4f578e795 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 @@ -221,28 +221,30 @@ public class Swagger2Parser extends SwaggerAbstractParser { // todo 路径变量 {xxx} 是否要转换 for (Parameter parameter : parameters) { - switch (parameter.getIn()) { - case SwaggerParameterType.PATH: - parsePathParameters(parameter, request.getRest()); - break; - case SwaggerParameterType.QUERY: - parseQueryParameters(parameter, request.getArguments()); - break; - case SwaggerParameterType.FORM_DATA: - parseFormDataParameters((FormParameter) parameter, request.getBody()); - break; - case SwaggerParameterType.BODY: - parseRequestBodyParameters(parameter, request.getBody()); - break; - case SwaggerParameterType.HEADER: - parseHeaderParameters(parameter, request.getHeaders()); - break; - case SwaggerParameterType.COOKIE: - parseCookieParameters(parameter, request.getHeaders()); - break; + if (StringUtils.isNotBlank(parameter.getIn())) { + switch (parameter.getIn()) { + case SwaggerParameterType.PATH: + parsePathParameters(parameter, request.getRest()); + break; + case SwaggerParameterType.QUERY: + parseQueryParameters(parameter, request.getArguments()); + break; + case SwaggerParameterType.FORM_DATA: + parseFormDataParameters((FormParameter) parameter, request.getBody()); + break; + case SwaggerParameterType.BODY: + parseRequestBodyParameters(parameter, request.getBody()); + break; + case SwaggerParameterType.HEADER: + parseHeaderParameters(parameter, request.getHeaders()); + break; + case SwaggerParameterType.COOKIE: + parseCookieParameters(parameter, request.getHeaders()); + break; // case SwaggerParameterType.FILE: // parsePathParameters(parameter, request); // break; + } } } }