refactor: post请求url优化

This commit is contained in:
chenjianxing 2020-07-27 10:11:45 +08:00
parent 3841ff55d8
commit 0fd89fc6be
1 changed files with 10 additions and 2 deletions

View File

@ -663,11 +663,19 @@ class JMXHttpRequest {
getPostQueryParameters(request, path) {
if (this.method.toUpperCase() !== "GET") {
path += '?';
let parameters = [];
request.parameters.forEach(parameter => {
if (parameter.name) {
path += ((parameter.name) + '=' + (parameter.value) + '&');
if (parameter.name && parameter.value) {
parameters.push(parameter);
}
});
for (let i = 0; i < parameters.length; i++) {
let parameter = parameters[i];
path += (encodeURIComponent(parameter.name) + '=' + encodeURIComponent(parameter.value));
if (i != parameters.length -1) {
path += '&';
}
}
}
return path;
}