fix(接口测试): 修复自定义请求 Query 参数重复解析问题

【【接口测试】github#32188,场景详情里,自定义请求,点击&取消url后面的引用环境,query参数会重复添加,场景是postman文件导入的】
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001044216

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2024-10-31 17:28:02 +08:00 committed by Craftsman
parent 57db563ec9
commit 07ddc8f8e7
1 changed files with 14 additions and 10 deletions

View File

@ -151,16 +151,20 @@ export default {
let keyValues = param.split('=');
if (keyValues) {
this.isUrl = true;
this.request.arguments.splice(
0,
0,
new KeyValue({
name: keyValues[0],
required: false,
value: keyValues[1],
isEdit: false,
})
);
//
const existingParam = this.request.arguments.find((arg) => arg.name === keyValues[0]);
if (!existingParam) {
this.request.arguments.splice(
0,
0,
new KeyValue({
name: keyValues[0],
required: false,
value: decodeURIComponent(keyValues[1] || ''), //
isEdit: false,
})
);
}
}
}
});