diff --git a/frontend/src/business/components/api/test/components/ApiRequestForm.vue b/frontend/src/business/components/api/test/components/ApiRequestForm.vue index 83184a8476..6143c8adf1 100644 --- a/frontend/src/business/components/api/test/components/ApiRequestForm.vue +++ b/frontend/src/business/components/api/test/components/ApiRequestForm.vue @@ -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); } }, diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 8b84423be5..ecc02724f6 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -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 + '&'); + } + }); } } }