fix: 环境里的请求头会优先于请求里的请求头

This commit is contained in:
chenjianxing 2021-02-03 13:48:41 +08:00
parent 21f8e54069
commit 16b2b185ed
1 changed files with 6 additions and 3 deletions

View File

@ -207,14 +207,17 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
final HashTree httpSamplerTree = tree.add(sampler);
// 注意顺序放在config前面会优先于环境的请求头生效
if (CollectionUtils.isNotEmpty(this.headers)) {
setHeader(httpSamplerTree, this.headers);
}
// 通用请求Headers
if (config != null && config.getConfig() != null && config.getConfig().getHttpConfig() != null
&& CollectionUtils.isNotEmpty(config.getConfig().getHttpConfig().getHeaders())) {
setHeader(httpSamplerTree, config.getConfig().getHttpConfig().getHeaders());
}
if (CollectionUtils.isNotEmpty(this.headers)) {
setHeader(httpSamplerTree, this.headers);
}
//判断是否要开启DNS
if (config != null && config.getConfig() != null && config.getConfig().getCommonConfig() != null