diff --git a/frontend/src/business/components/api/definition/components/ApiConfig.vue b/frontend/src/business/components/api/definition/components/ApiConfig.vue index bceea6b325..cb150374f5 100644 --- a/frontend/src/business/components/api/definition/components/ApiConfig.vue +++ b/frontend/src/business/components/api/definition/components/ApiConfig.vue @@ -80,6 +80,18 @@ if (!this.request.hashTree) { this.request.hashTree = []; } + // 处理导入数据缺失问题 + if (this.response.body) { + let body = new Body(); + Object.assign(body, this.response.body); + if (!body.binary) { + body.binary = []; + } + if (!body.kvs) { + body.kvs = []; + } + this.response.body = body; + } }, methods: { runTest(data) { diff --git a/frontend/src/business/components/api/definition/components/ApiVariable.vue b/frontend/src/business/components/api/definition/components/ApiVariable.vue index 340ddde6a5..dfa759ddb6 100644 --- a/frontend/src/business/components/api/definition/components/ApiVariable.vue +++ b/frontend/src/business/components/api/definition/components/ApiVariable.vue @@ -199,16 +199,14 @@ } }, created() { - if (this.parameters) { - if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) { - this.parameters.push(new KeyValue({ - type: 'text', - enable: true, - required: true, - uuid: this.uuid(), - contentType: 'text/plain' - })); - } + if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) { + this.parameters.push(new KeyValue({ + type: 'text', + enable: true, + required: true, + uuid: this.uuid(), + contentType: 'text/plain' + })); } } } diff --git a/frontend/src/business/components/api/definition/components/basis/AddBasisApi.vue b/frontend/src/business/components/api/definition/components/basis/AddBasisApi.vue index 8e62d99f68..98760944da 100644 --- a/frontend/src/business/components/api/definition/components/basis/AddBasisApi.vue +++ b/frontend/src/business/components/api/definition/components/basis/AddBasisApi.vue @@ -94,7 +94,7 @@ saveApi(saveAs) { this.$refs['httpForm'].validate((valid) => { if (valid) { - if(this.httpForm.path.match(/\s/)!=null){ + if (this.httpForm.path && this.httpForm.path.match(/\s/) != null) { this.$error(this.$t("api_test.definition.request.path_valid_info")); return false; } diff --git a/frontend/src/business/components/api/definition/components/response/ResponseText.vue b/frontend/src/business/components/api/definition/components/response/ResponseText.vue index 213b965dfc..688789ccd2 100644 --- a/frontend/src/business/components/api/definition/components/response/ResponseText.vue +++ b/frontend/src/business/components/api/definition/components/response/ResponseText.vue @@ -8,7 +8,7 @@ - +