From 4cb0940b285b74b32eff933a8ea2f5fe3a703f72 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 4 Aug 2020 16:20:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=88=86=E6=94=AF=E7=9A=84=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/test/model/ScenarioModel.js | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 2d8a6ddee6..7a37967fac 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -1,18 +1,22 @@ import { - Element, - TestElement, - HashTree, - TestPlan, - ThreadGroup, - HeaderManager, - HTTPSamplerProxy, - HTTPSamplerArguments, Arguments, + DubboSample, DurationAssertion, + Element, + HashTree, + HeaderManager, + HTTPSamplerArguments, + HTTPSamplerProxy, + JSONPathAssertion, + JSONPostProcessor, + RegexExtractor, ResponseCodeAssertion, ResponseDataAssertion, ResponseHeadersAssertion, - RegexExtractor, JSONPostProcessor, XPath2Extractor, DubboSample, JSONPathAssertion, + TestElement, + TestPlan, + ThreadGroup, + XPath2Extractor, } from "./JMX"; export const uuid = function () { @@ -285,6 +289,11 @@ export class HttpRequest extends Request { isValid: false, info: 'api_test.request.please_configure_environment_in_scenario' } + } else if (!this.path) { + return { + isValid: false, + info: 'api_test.request.input_path' + } } } else { if (!this.url) { @@ -663,11 +672,12 @@ class JMXHttpRequest { this.protocol = url.protocol.split(":")[0]; this.pathname = this.getPostQueryParameters(request, decodeURIComponent(url.pathname)); } else { - this.port = environment.port; - this.protocol = environment.protocol; - this.domain = environment.domain; - let url = new URL(environment.protocol + "://" + environment.socket); - this.path = this.getPostQueryParameters(request, decodeURIComponent(url.pathname)); + if (environment) { + this.port = environment.port; + this.protocol = environment.protocol; + this.domain = environment.domain; + } + this.path = this.getPostQueryParameters(request, decodeURIComponent(request.path)); } } } @@ -683,8 +693,8 @@ class JMXHttpRequest { }); 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 += (parameter.name + '=' + parameter.value); + if (i != parameters.length - 1) { path += '&'; } }