fix(场景自动化): 修复快捷调试相关问题

This commit is contained in:
fit2-zhao 2021-01-28 16:25:33 +08:00
parent 26a1acec56
commit 2df92c398f
2 changed files with 7 additions and 12 deletions

View File

@ -147,7 +147,6 @@
saveApiAndCase(api) {
this.visible = true;
this.api = api;
console.log(api)
this.addCase();
},
setEnvironment(environment) {

View File

@ -198,22 +198,18 @@
},
urlChange() {
if (!this.debugForm.url) return;
let url = this.getURL(this.addProtocol(this.debugForm.url));
if (url) {
let url = this.getURL(this.debugForm.url);
if (url && url.pathname) {
if (this.debugForm.url.indexOf('?') != -1) {
this.debugForm.url = decodeURIComponent(this.debugForm.url.substr(0, this.debugForm.url.indexOf("?")));
}
this.debugForm.path = url.pathname;
} else {
this.debugForm.path = url;
}
},
addProtocol(url) {
if (url) {
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
return "https://" + url;
}
}
return url;
},
getURL(urlStr) {
try {
let url = new URL(urlStr);
@ -224,7 +220,7 @@
});
return url;
} catch (e) {
this.$error(this.$t('api_test.request.url_invalid'), 2000);
return urlStr;
}
},
}