From 21331112dbc9c9102f5bea95ffd20e794463bbe2 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 21 Oct 2021 14:48:58 +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=8D=E5=88=9B=E5=BB=BA/=E6=9B=B4?= =?UTF-8?q?=E6=96=B0mock=E6=97=B6=E5=BF=85=E5=A1=AB=E9=A1=B9=E7=9A=84?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复创建/更新mock时必填项的检查失效问题 --- .../mock/Components/MockResponseParam.vue | 6 ++++++ .../definition/components/mock/MockEditDrawer.vue | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/definition/components/mock/Components/MockResponseParam.vue b/frontend/src/business/components/api/definition/components/mock/Components/MockResponseParam.vue index b9a1d37901..8f2518f662 100644 --- a/frontend/src/business/components/api/definition/components/mock/Components/MockResponseParam.vue +++ b/frontend/src/business/components/api/definition/components/mock/Components/MockResponseParam.vue @@ -105,6 +105,12 @@ export default { if (!this.response || !this.response || !this.response.headers) { return; } + if(!this.response.httpCode || this.response.httpCode === ''){ + this.$set(this.response,"httpCode","200"); + } + if(!this.response.delayed){ + this.response.delayed = 0; + } if (Object.prototype.toString.call(this.response).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') { this.response = JSON.parse(this.response); } diff --git a/frontend/src/business/components/api/definition/components/mock/MockEditDrawer.vue b/frontend/src/business/components/api/definition/components/mock/MockEditDrawer.vue index 6ce01a8d96..017d7bb2b2 100644 --- a/frontend/src/business/components/api/definition/components/mock/MockEditDrawer.vue +++ b/frontend/src/business/components/api/definition/components/mock/MockEditDrawer.vue @@ -100,10 +100,10 @@ export default { }, response: { httpCode: "", - delayed: "", httpHeads: [], body: "", responseResult:{ + delayed: 0, headers:[], arguments:[], rest:[], @@ -234,6 +234,18 @@ export default { uploadMockExpectConfig(clearForm) { let url = "/mockConfig/updateMockExpectConfig"; let param = this.mockExpectConfig; + if(!param.name || param.name === ''){ + this.$error(this.$t('test_track.case.input_name')); + return false; + }else if(param.name.length > 100){ + this.$error(this.$t('test_track.length_less_than')+100); + return false; + } + + if(!param.response.responseResult.httpCode){ + param.response.responseResult.httpCode = 200; + } + if(!param.request.params.id){ param.request.params.id = getUUID(); }