fix(接口定义): 修复接口定义添加body文件切换到test文件丢失的缺陷 (#18176)
--bug=1017015 --user=王孝刚 【接口测试】接口定义-请求体上传文件-切换到TEST-更新接口-文件没了 https://www.tapd.cn/55049933/s/1249705 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
d6afeefae2
commit
02bc6be12b
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue