This commit is contained in:
shiziyuan9527 2020-08-10 17:58:21 +08:00
commit 57ec7ba0c9
3 changed files with 21 additions and 21 deletions

View File

@ -158,6 +158,12 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_functions</artifactId>
<version>${jmeter.version}</version>
</dependency>
<!-- Zookeeper --> <!-- Zookeeper -->
<dependency> <dependency>
<groupId>org.apache.dubbo</groupId> <groupId>org.apache.dubbo</groupId>

View File

@ -275,29 +275,23 @@ export class DubboSample extends DefaultTestElement {
} }
export class HTTPSamplerProxy extends DefaultTestElement { export class HTTPSamplerProxy extends DefaultTestElement {
constructor(testName, request) { constructor(testName, options = {}) {
super('HTTPSamplerProxy', 'HttpTestSampleGui', 'HTTPSamplerProxy', testName); super('HTTPSamplerProxy', 'HttpTestSampleGui', 'HTTPSamplerProxy', testName);
this.request = request || {};
if (request.useEnvironment) { this.stringProp("HTTPSampler.domain", options.domain);
this.stringProp("HTTPSampler.domain", request.domain); this.stringProp("HTTPSampler.protocol", options.protocol);
this.stringProp("HTTPSampler.protocol", request.protocol); this.stringProp("HTTPSampler.path", options.path);
this.stringProp("HTTPSampler.path", this.request.path);
} else { this.stringProp("HTTPSampler.method", options.method);
this.stringProp("HTTPSampler.domain", this.request.hostname); this.stringProp("HTTPSampler.contentEncoding", options.encoding, "UTF-8");
this.stringProp("HTTPSampler.protocol", this.request.protocol.split(":")[0]); if (!options.port) {
this.stringProp("HTTPSampler.path", this.request.pathname);
}
this.stringProp("HTTPSampler.method", this.request.method);
this.stringProp("HTTPSampler.contentEncoding", this.request.encoding, "UTF-8");
if (!this.request.port) {
this.stringProp("HTTPSampler.port", ""); this.stringProp("HTTPSampler.port", "");
} else { } else {
this.stringProp("HTTPSampler.port", this.request.port); this.stringProp("HTTPSampler.port", options.port);
} }
this.boolProp("HTTPSampler.follow_redirects", this.request.follow, true); this.boolProp("HTTPSampler.follow_redirects", options.follow, true);
this.boolProp("HTTPSampler.use_keepalive", this.request.keepalive, true); this.boolProp("HTTPSampler.use_keepalive", options.keepalive, true);
} }
} }

View File

@ -695,14 +695,14 @@ class JMXHttpRequest {
request.url = 'http://' + request.url; request.url = 'http://' + request.url;
} }
let url = new URL(request.url); let url = new URL(request.url);
this.hostname = decodeURIComponent(url.hostname); this.domain = decodeURIComponent(url.hostname);
this.port = url.port; this.port = url.port;
this.protocol = url.protocol.split(":")[0]; this.protocol = url.protocol.split(":")[0];
this.pathname = this.getPostQueryParameters(request, decodeURIComponent(url.pathname)); this.path = this.getPostQueryParameters(request, decodeURIComponent(url.pathname));
} else { } else {
this.domain = environment.domain;
this.port = environment.port; this.port = environment.port;
this.protocol = environment.protocol; this.protocol = environment.protocol;
this.domain = environment.domain;
let url = new URL(environment.protocol + "://" + environment.socket); let url = new URL(environment.protocol + "://" + environment.socket);
this.path = this.getPostQueryParameters(request, decodeURIComponent(url.pathname + (request.path ? request.path : ''))); this.path = this.getPostQueryParameters(request, decodeURIComponent(url.pathname + (request.path ? request.path : '')));
} }
@ -721,7 +721,7 @@ class JMXHttpRequest {
for (let i = 0; i < parameters.length; i++) { for (let i = 0; i < parameters.length; i++) {
let parameter = parameters[i]; let parameter = parameters[i];
path += (parameter.name + '=' + parameter.value); path += (parameter.name + '=' + parameter.value);
if (i != parameters.length - 1) { if (i !== parameters.length - 1) {
path += '&'; path += '&';
} }
} }