fix(接口测试): 修复接口测试的query参数会一直重复填写的缺陷

--bug=1013145 --user=王孝刚 [接口测试] github#13519接口测试的query参数会一直重复填写
https://www.tapd.cn/55049933/s/1157632
This commit is contained in:
wxg0103 2022-05-13 11:30:22 +08:00 committed by 刘瑞斌
parent b483501b00
commit 7a9bf0baf5
2 changed files with 4 additions and 3 deletions

View File

@ -63,7 +63,7 @@ export default {
this.isUrl = false;
if (!this.request.path || this.request.path.indexOf('?') === -1) return;
let url = this.getURL(this.addProtocol(this.request.path));
if (url && this.isUrl) {
if (url) {
this.request.path = decodeURIComponent(this.request.path.substr(0, this.request.path.indexOf("?")));
}
},
@ -76,7 +76,7 @@ export default {
let url = this.getURL(this.addProtocol(this.request.url));
if (url) {
let paramUrl = this.request.url.substr(this.request.url.indexOf("?") + 1);
if (paramUrl && this.isUrl) {
if (paramUrl) {
this.request.url = decodeURIComponent(this.request.url.substr(0, this.request.url.indexOf("?")));
}
}
@ -99,6 +99,7 @@ export default {
if (param) {
let keyValues = param.split("=");
if (keyValues) {
this.isUrl = true;
this.request.arguments.splice(0, 0, new KeyValue({
name: keyValues[0],
required: false,

View File

@ -497,7 +497,7 @@ export default {
},
getURL(urlStr) {
try {
let url = urlStr;
let url = new URL(urlStr);
if (url.search && url.search.length > 1) {
let params = url.search.substr(1).split("&");
params.forEach(param => {