From 45dfbba11faaec4fb9855c209482e9a5f3385b48 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 17 Jun 2021 17:21:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Durl=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=BF=85=E5=A1=AB=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复url参数是否必填不显示的问题 --- .../io/metersphere/api/service/ApiDocumentService.java | 10 +++++++--- .../components/document/ApiDocumentAnchor.vue | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) 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/> - + + + +