diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDocumentService.java b/backend/src/main/java/io/metersphere/api/service/ApiDocumentService.java index e015f3ca5e..34367d938b 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDocumentService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDocumentService.java @@ -121,7 +121,7 @@ public class ApiDocumentService { JSONArray headArr = requestObj.getJSONArray("rest"); for (int index = 0; index < headArr.size(); index++) { JSONObject headObj = headArr.getJSONObject(index); - if (headObj.containsKey("name") && headObj.containsKey("value")) { + if (headObj.containsKey("name")) { urlParamArr.add(headObj); } } @@ -176,9 +176,13 @@ public class ApiDocumentService { Map previewObjMap = new LinkedHashMap<>(); for (int i = 0; i < kvsArr.size(); i++) { JSONObject kv = kvsArr.getJSONObject(i); - if (kv.containsKey("name") && kv.containsKey("value")) { + if (kv.containsKey("name")) { + String value = ""; + if(kv.containsKey("value")){ + value = String.valueOf(kv.get("value")); + } bodyParamArr.add(kv); - previewObjMap.put(String.valueOf(kv.get("name")), String.valueOf(kv.get("value"))); + previewObjMap.put(String.valueOf(kv.get("name")), value); } } this.setPreviewData(previewJsonArray, JSONObject.toJSONString(previewObjMap)); diff --git a/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue b/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue index 71e68024d1..82a1466401 100644 --- a/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue +++ b/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue @@ -131,8 +131,13 @@ :label="$t('api_test.definition.document.table_coloum.name')" min-width="120px" show-overflow-tooltip/> - + + + +