From 505a99010765e10f6ea3dd404c231e5fcf2ca520 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 21 Oct 2021 15:05:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(Mock=E8=87=AA=E5=AE=9A=E4=B9=89=E8=84=9A?= =?UTF-8?q?=E6=9C=AC):=20=E4=BF=AE=E5=A4=8DMock=E6=9C=9F=E6=9C=9B=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E6=97=B6=E5=AD=98=E5=9C=A8=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复Mock期望填写时存在的样式问题 --- .../java/io/metersphere/api/service/MockConfigService.java | 6 +++++- .../components/mock/Components/MockApiScriptEditor.vue | 6 +++--- .../components/mock/Components/MockResponseParam.vue | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/MockConfigService.java b/backend/src/main/java/io/metersphere/api/service/MockConfigService.java index 72bdfcf92e..520cf85bcc 100644 --- a/backend/src/main/java/io/metersphere/api/service/MockConfigService.java +++ b/backend/src/main/java/io/metersphere/api/service/MockConfigService.java @@ -651,7 +651,11 @@ public class MockConfigService { returnStr = MockApiUtils.getResultByResponseResult(responseJsonObj.getJSONObject("body"), url, headerMap, requestMockParams); } if (responseJsonObj.containsKey("httpCode")) { - response.setStatus(Integer.parseInt(responseJsonObj.getString("httpCode"))); + int httpCodeNum = 500; + try { + httpCodeNum = Integer.parseInt(responseJsonObj.getString("httpCode")); + }catch (Exception e){} + response.setStatus(httpCodeNum); } if (responseJsonObj.containsKey("delayed")) { try { diff --git a/frontend/src/business/components/api/definition/components/mock/Components/MockApiScriptEditor.vue b/frontend/src/business/components/api/definition/components/mock/Components/MockApiScriptEditor.vue index 46af689ba5..c58af354c3 100644 --- a/frontend/src/business/components/api/definition/components/mock/Components/MockApiScriptEditor.vue +++ b/frontend/src/business/components/api/definition/components/mock/Components/MockApiScriptEditor.vue @@ -1,6 +1,6 @@