From 8002dc2c4f84f3e16484b8a86357e814f43f4488 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 4 Nov 2021 14:06:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(Mock=E6=9C=8D=E5=8A=A1):=20#1007715=20#1007?= =?UTF-8?q?716=20#1007717=20#1007711=20Mock=E6=9C=8D=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E3=80=81=E5=8C=B9=E9=85=8D=E3=80=81=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=97=B6=E7=9A=84=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1007715 --user=宋天阳 【接口定义】mock参数多了一个键 https://www.tapd.cn/55049933/s/1064027;--bug=1007716 --user=宋天阳 【接口测试】mock调试报错后,再编辑mock规则,不能自动带出来请求参数下拉框 https://www.tapd.cn/55049933/s/1064025;--bug=1007717 --user=宋天阳 【接口定义】mock规则部分匹配,没有返回mock信息 https://www.tapd.cn/55049933/s/1064023;--bug=1007711 --user=宋天阳 【接口定义】mock服务的URL会自动补一个“/” https://www.tapd.cn/55049933/s/1064026 --- .../api/service/ApiDefinitionService.java | 1 + .../commons/utils/JsonStructUtils.java | 2 +- .../complete/EditCompleteHTTPApi.vue | 7 +--- .../mock/Components/MockApiVariable.vue | 38 +++++-------------- .../definition/components/mock/MockTab.vue | 17 +++++++-- 5 files changed, 27 insertions(+), 38 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index f4887428e0..cf0b1a87bd 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -625,6 +625,7 @@ public class ApiDefinitionService { batchMapper.insert(apiDefinition); String requestStr = setImportHashTree(apiDefinition); reSetImportCasesApiId(cases, originId, apiDefinition.getId()); + reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum()); apiDefinition.setRequest(requestStr); importApiCase(apiDefinition, apiTestImportRequest); } diff --git a/backend/src/main/java/io/metersphere/commons/utils/JsonStructUtils.java b/backend/src/main/java/io/metersphere/commons/utils/JsonStructUtils.java index 7b877743ec..721b407518 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/JsonStructUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/JsonStructUtils.java @@ -30,7 +30,7 @@ public class JsonStructUtils { if(matchObj == null){ matchObj = new JSONObject(); } - if (sourceObj .isEmpty() && matchObj.isEmpty()) { + if (matchObj.isEmpty()) { return true; } else if (sourceObj != null && matchObj != null) { boolean lastMatchResultIsTrue = false; diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index cd8e98888d..d2976ac773 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -274,10 +274,6 @@ return this.mockBaseUrl; } else { let path = this.httpForm.path; - let prefix = ""; - if (path.endsWith("/")) { - prefix = "/"; - } let protocol = this.httpForm.method; if (protocol === 'GET' || protocol === 'DELETE') { if (this.httpForm.request != null && this.httpForm.request.rest != null) { @@ -303,8 +299,7 @@ } } } - - return this.mockBaseUrl + path + prefix; + return this.mockBaseUrl + path; } } }, diff --git a/frontend/src/business/components/api/definition/components/mock/Components/MockApiVariable.vue b/frontend/src/business/components/api/definition/components/mock/Components/MockApiVariable.vue index f4d74d035d..8a8028a7ab 100644 --- a/frontend/src/business/components/api/definition/components/mock/Components/MockApiVariable.vue +++ b/frontend/src/business/components/api/definition/components/mock/Components/MockApiVariable.vue @@ -3,16 +3,8 @@ {{ description }} - - -
- - - - - @@ -31,16 +23,19 @@ + :fetch-suggestions="querySearch" @change="change" :placeholder="keyText" show-word-limit> + + - - - - - - - - - @@ -76,12 +67,6 @@ - - - - - - @@ -102,13 +87,10 @@