提交 3c797c64 编写于 作者: C chenjianxing

fix post请求url参数问题

上级 0e11e907
......@@ -91,12 +91,11 @@
let url = new URL(this.addProtocol(this.request.url));
url.searchParams.forEach((value, key) => {
if (key && value) {
parameters.push(new KeyValue(key, value));
this.request.parameters.splice(0, 0, new KeyValue(key, value));
}
});
// 添加一个空的,用于填写
parameters.push(new KeyValue());
this.request.parameters = parameters;
this.request.url = this.getURL(url);
} catch (e) {
this.$error(this.$t('api_test.request.url_invalid'), 2000)
......@@ -128,7 +127,7 @@
return url;
},
getURL(url) {
return decodeURIComponent(url.origin + url.pathname) + "?" + url.searchParams.toString();
return decodeURIComponent(url.origin + url.pathname);
}
},
......
......@@ -394,7 +394,13 @@ class JMXRequest {
this.port = url.port;
this.protocol = url.protocol.split(":")[0];
if (this.method.toUpperCase() !== "GET") {
this.pathname += url.search.replace('&', '&');
// this.pathname += url.search.replace('&', '&');
this.pathname += '?';
request.parameters.forEach(parameter => {
if (parameter.name) {
this.pathname += (parameter.name + '=' + parameter.value + '&');
}
});
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册