diff --git a/backend/pom.xml b/backend/pom.xml index 50e2ee6ea5..a1ec89c531 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -219,7 +219,7 @@ io.metersphere jmeter-plugins-dubbo - 2.7.9 + 2.7.10 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 a9338a6ddf..399efb3f6e 100644 --- a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java @@ -135,16 +135,21 @@ public class Swagger2Parser extends ApiImportAbstractParser { simpleRef = refModel.getSimpleRef(); } Model model = definitions.get(simpleRef); - JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions); + HashSet refSet = new HashSet<>(); + refSet.add(simpleRef); + JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions, refSet); body.setRaw(bodyParameters.toJSONString()); } else if (schema instanceof ArrayModel) { ArrayModel arrayModel = (ArrayModel) bodyParameter.getSchema(); Property items = arrayModel.getItems(); if (items instanceof RefProperty) { RefProperty refProperty = (RefProperty) items; - Model model = definitions.get(refProperty.getSimpleRef()); + String simpleRef = refProperty.getSimpleRef(); + HashSet refSet = new HashSet<>(); + refSet.add(simpleRef); + Model model = definitions.get(simpleRef); JSONArray propertyList = new JSONArray(); - propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions)); + propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions, refSet)); body.setRaw(propertyList.toString()); } } @@ -152,20 +157,26 @@ public class Swagger2Parser extends ApiImportAbstractParser { body.setFormat("json"); } - private JSONObject getBodyJSONObjectParameters(Map properties, Map definitions) { + private JSONObject getBodyJSONObjectParameters(Map properties, Map definitions, HashSet refSet) { JSONObject jsonObject = new JSONObject(); properties.forEach((key, value) -> { if (value instanceof ObjectProperty) { ObjectProperty objectProperty = (ObjectProperty) value; - jsonObject.put(key, getBodyJSONObjectParameters(objectProperty.getProperties(), definitions)); + jsonObject.put(key, getBodyJSONObjectParameters(objectProperty.getProperties(), definitions, refSet)); } else if (value instanceof ArrayProperty) { ArrayProperty arrayProperty = (ArrayProperty) value; Property items = arrayProperty.getItems(); if (items instanceof RefProperty) { RefProperty refProperty = (RefProperty) items; - Model model = definitions.get(refProperty.getSimpleRef()); + String simpleRef = refProperty.getSimpleRef(); + if (refSet.contains(simpleRef)) { + jsonObject.put(key, new JSONArray()); + return; + } + refSet.add(simpleRef); + Model model = definitions.get(simpleRef); JSONArray propertyList = new JSONArray(); - propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions)); + propertyList.add(getBodyJSONObjectParameters(model.getProperties(), definitions, refSet)); jsonObject.put(key, propertyList); } else { jsonObject.put(key, new ArrayList<>()); diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 7d553cb0b9..a2927ffc59 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -749,13 +749,15 @@ class JMXHttpRequest { getPostQueryParameters(request, path) { if (this.method.toUpperCase() !== "GET") { - path += '?'; let parameters = []; request.parameters.forEach(parameter => { if (parameter.name && parameter.value) { parameters.push(parameter); } }); + if (parameters.length > 0) { + path += '?'; + } for (let i = 0; i < parameters.length; i++) { let parameter = parameters[i]; path += (parameter.name + '=' + parameter.value); @@ -942,7 +944,7 @@ class JMXGenerator { addBodyFormat(request) { let bodyFormat = request.body.format; - if (bodyFormat) { + if (!request.body.isKV() && bodyFormat) { switch (bodyFormat) { case BODY_FORMAT.JSON: this.addContentType(request, 'application/json'); diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index b6eff8e094..875ad1583f 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -286,4 +286,8 @@ export default { cursor: pointer; } + pre { + margin: 0 0; + } + diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index 6deb11b4ae..90daac46c3 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -75,13 +75,13 @@ - + - + @@ -137,13 +137,13 @@ - + - + diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 1fce729a44..f3a96dc71c 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -141,29 +141,29 @@ @@ -512,18 +512,6 @@