fix: 场景下无请求是保存报错

This commit is contained in:
chenjianxing 2020-09-23 16:18:16 +08:00
parent 4ec1f387a5
commit 9d8d77ef9a
1 changed files with 6 additions and 2 deletions

View File

@ -1056,7 +1056,7 @@ class JMXGenerator {
this.addScenarioCookieManager(threadGroup, scenario);
// 放在计划或线程组中,不建议放具体某个请求中
this.addDNSCacheManager(threadGroup, scenario.requests[0]);
this.addDNSCacheManager(threadGroup, scenario);
this.addJDBCDataSources(threadGroup, scenario);
@ -1138,7 +1138,11 @@ class JMXGenerator {
}
}
addDNSCacheManager(threadGroup, request) {
addDNSCacheManager(threadGroup, scenario) {
if (scenario.requests.length < 1) {
return
}
let request = scenario.requests[0];
if (request.environment) {
let commonConfig = request.environment.config.commonConfig;
let hosts = commonConfig.hosts;