fix(接口测试): 修复接口测试的query参数会一直重复填写的缺陷
--bug=1013145 --user=王孝刚 [接口测试] github#13519接口测试的query参数会一直重复填写 https://www.tapd.cn/55049933/s/1157632
This commit is contained in:
parent
8ef94fa477
commit
d343ecd2d9
|
@ -63,7 +63,7 @@ export default {
|
||||||
this.isUrl = false;
|
this.isUrl = false;
|
||||||
if (!this.request.path || this.request.path.indexOf('?') === -1) return;
|
if (!this.request.path || this.request.path.indexOf('?') === -1) return;
|
||||||
let url = this.getURL(this.addProtocol(this.request.path));
|
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("?")));
|
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));
|
let url = this.getURL(this.addProtocol(this.request.url));
|
||||||
if (url) {
|
if (url) {
|
||||||
let paramUrl = this.request.url.substr(this.request.url.indexOf("?") + 1);
|
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("?")));
|
this.request.url = decodeURIComponent(this.request.url.substr(0, this.request.url.indexOf("?")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,7 @@ export default {
|
||||||
if (param) {
|
if (param) {
|
||||||
let keyValues = param.split("=");
|
let keyValues = param.split("=");
|
||||||
if (keyValues) {
|
if (keyValues) {
|
||||||
|
this.isUrl = true;
|
||||||
this.request.arguments.splice(0, 0, new KeyValue({
|
this.request.arguments.splice(0, 0, new KeyValue({
|
||||||
name: keyValues[0],
|
name: keyValues[0],
|
||||||
required: false,
|
required: false,
|
||||||
|
|
|
@ -497,7 +497,7 @@ export default {
|
||||||
},
|
},
|
||||||
getURL(urlStr) {
|
getURL(urlStr) {
|
||||||
try {
|
try {
|
||||||
let url = urlStr;
|
let url = new URL(urlStr);
|
||||||
if (url.search && url.search.length > 1) {
|
if (url.search && url.search.length > 1) {
|
||||||
let params = url.search.substr(1).split("&");
|
let params = url.search.substr(1).split("&");
|
||||||
params.forEach(param => {
|
params.forEach(param => {
|
||||||
|
|
Loading…
Reference in New Issue