fix: 旧版复制请求,文件上传参数同步修改问题

This commit is contained in:
chenjianxing 2021-01-05 10:05:17 +08:00
parent 24e89b5b3c
commit 6b076416fb
1 changed files with 15 additions and 1 deletions

View File

@ -118,7 +118,21 @@ export default {
}, },
copyRequest(index) { copyRequest(index) {
let request = this.scenario.requests[index]; let request = this.scenario.requests[index];
this.scenario.requests.push(new RequestFactory(request)); let item = new RequestFactory(request);
if (item.body && item.body.kvs) {
item.body.kvs.forEach(kv => {
let files = [];
if (kv.files) {
kv.files.forEach(file => {
let fileCopy = {};
Object.assign(fileCopy, file);
files.push(fileCopy);
})
}
kv.files = files;
});
}
this.scenario.requests.push(item);
}, },
disableRequest(index) { disableRequest(index) {
this.scenario.requests[index].enable = false; this.scenario.requests[index].enable = false;