diff --git a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java index 4b293deb5b..ad8a7ab7e0 100644 --- a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java @@ -270,7 +270,12 @@ public class Swagger2Parser extends SwaggerAbstractParser { refSet.add(simpleRef); Model model = this.definitions.get(simpleRef); JSONArray propertyList = new JSONArray(); - propertyList.add(getBodyParameters(model.getProperties(), refSet)); + if (model != null) { + propertyList.add(getBodyParameters(model.getProperties(), refSet)); + } else { + propertyList.add(new JSONObject()); + } + jsonObject.put(key, propertyList); } else { jsonObject.put(key, new ArrayList<>()); diff --git a/frontend/src/business/components/api/definition/components/environment/EnvironmentHttpConfig.vue b/frontend/src/business/components/api/definition/components/environment/EnvironmentHttpConfig.vue index 8df17a59dd..91b4d256f9 100644 --- a/frontend/src/business/components/api/definition/components/environment/EnvironmentHttpConfig.vue +++ b/frontend/src/business/components/api/definition/components/environment/EnvironmentHttpConfig.vue @@ -49,7 +49,8 @@ }, methods: { validateSocket(socket) { - if (!socket) return true; + // if (!socket) return true; + if (socket !== ''){ let urlStr = this.httpConfig.protocol + '://' + socket; let url = {}; try { @@ -58,7 +59,6 @@ return false; } this.httpConfig.domain = decodeURIComponent(url.hostname); - this.httpConfig.port = url.port; let path = url.pathname === '/' ? '' : url.pathname; if (url.port) { @@ -67,6 +67,13 @@ this.httpConfig.socket = this.httpConfig.domain + path; } return true; + }else { + this.httpConfig.domain = socket; + this.httpConfig.port = ''; + this.httpConfig.socket = socket; + return true; + } + }, validate() { let isValidate = false;