Merge remote-tracking branch 'origin/master'

This commit is contained in:
q4speed 2020-09-07 16:11:23 +08:00
commit c1dfe05e87
3 changed files with 8 additions and 5 deletions

View File

@ -123,6 +123,9 @@
validateDomain(domain) { validateDomain(domain) {
let url = {}; let url = {};
try { try {
if (!domain.startsWith("http") || !domain.startsWith("https")) {
domain += "http://";
}
url = new URL(domain); url = new URL(domain);
} catch (e) { } catch (e) {
this.$warning(this.$t('load_test.input_domain')); this.$warning(this.$t('load_test.input_domain'));

View File

@ -504,8 +504,8 @@ export class DNSCacheManager extends DefaultTestElement {
let collectionPropHosts = this.collectionProp('DNSCacheManager.hosts'); let collectionPropHosts = this.collectionProp('DNSCacheManager.hosts');
hosts.forEach(host => { hosts.forEach(host => {
let elementProp = collectionPropHosts.elementProp('', 'StaticHost'); let elementProp = collectionPropHosts.elementProp(host.domain, 'StaticHost');
if (host && host.domain.trim() === domain.trim()) { if (host && host.domain.trim().indexOf(domain.trim()) != -1) {
elementProp.stringProp('StaticHost.Name', host.domain); elementProp.stringProp('StaticHost.Name', host.domain);
elementProp.stringProp('StaticHost.Address', host.ip); elementProp.stringProp('StaticHost.Address', host.ip);
} }

View File

@ -956,8 +956,8 @@ class JMXGenerator {
let name = request.name + " DNSCacheManager"; let name = request.name + " DNSCacheManager";
let hosts = JSON.parse(request.environment.hosts); let hosts = JSON.parse(request.environment.hosts);
if (hosts.length > 0) { if (hosts.length > 0) {
let domain = request.environment.protocol + "://" + request.environment.domain; //let domain = request.environment.protocol + "://" + request.environment.domain;
threadGroup.put(new DNSCacheManager(name, domain, hosts)); threadGroup.put(new DNSCacheManager(name, request.environment.domain, hosts));
} }
} }
} }
@ -1038,7 +1038,7 @@ class JMXGenerator {
this.addRequestBodyFile(httpSamplerProxy, request, testId); this.addRequestBodyFile(httpSamplerProxy, request, testId);
} else { } else {
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true); httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
body.push({name: '', value: request.body.raw, encode: false}); body.push({name: '', value: request.body.raw, encode: false, enable: true});
} }
httpSamplerProxy.add(new HTTPSamplerArguments(body)); httpSamplerProxy.add(new HTTPSamplerArguments(body));