From 02bc6be12bfddb2699e9b870bdf601c4f197dba8 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Thu, 22 Sep 2022 11:26:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0body=E6=96=87=E4=BB=B6=E5=88=87=E6=8D=A2=E5=88=B0test?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=A2=E5=A4=B1=E7=9A=84=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=20(#18176)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017015 --user=王孝刚 【接口测试】接口定义-请求体上传文件-切换到TEST-更新接口-文件没了 https://www.tapd.cn/55049933/s/1249705 Co-authored-by: wxg0103 <727495428@qq.com> --- .../components/runtest/RunTestHTTPPage.vue | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue index 29b1383533..524440878f 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue @@ -394,6 +394,7 @@ export default { init() { // 深度复制 this.api = JSON.parse(JSON.stringify(this.apiData)); + this.initLocalFile(); this.api.protocol = this.currentProtocol; this.currentRequest = this.api.request; if (!this.api.environmentId && this.$store.state.useEnvironment) { @@ -401,6 +402,28 @@ export default { } this.runLoading = false; this.checkVersionEnable(); + }, + initLocalFile() { + if (this.apiData.request && this.apiData.request.body) { + if (this.apiData.request.body.binary && this.apiData.request.body.binary.length > 0) { + this.apiData.request.body.binary.forEach(item => { + this.api.request.body.binary.forEach(api => { + if (item.uuid && api.uuid && item.uuid === api.uuid) { + api = item; + } + }) + }) + } + if (this.apiData.request.body.kvs && this.apiData.request.body.kvs.length > 0) { + this.apiData.request.body.kvs.forEach(item => { + this.api.request.body.kvs.forEach(api => { + if (item.uuid && api.uuid && item.uuid === api.uuid && item.files && api.files) { + api.files = item.files; + } + }) + }) + } + } } }, created() {