fix: 环境里的请求头会优先于请求里的请求头
This commit is contained in:
parent
21f8e54069
commit
16b2b185ed
|
@ -207,14 +207,17 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
final HashTree httpSamplerTree = tree.add(sampler);
|
final HashTree httpSamplerTree = tree.add(sampler);
|
||||||
|
|
||||||
|
// 注意顺序,放在config前面,会优先于环境的请求头生效
|
||||||
|
if (CollectionUtils.isNotEmpty(this.headers)) {
|
||||||
|
setHeader(httpSamplerTree, this.headers);
|
||||||
|
}
|
||||||
|
|
||||||
// 通用请求Headers
|
// 通用请求Headers
|
||||||
if (config != null && config.getConfig() != null && config.getConfig().getHttpConfig() != null
|
if (config != null && config.getConfig() != null && config.getConfig().getHttpConfig() != null
|
||||||
&& CollectionUtils.isNotEmpty(config.getConfig().getHttpConfig().getHeaders())) {
|
&& CollectionUtils.isNotEmpty(config.getConfig().getHttpConfig().getHeaders())) {
|
||||||
setHeader(httpSamplerTree, config.getConfig().getHttpConfig().getHeaders());
|
setHeader(httpSamplerTree, config.getConfig().getHttpConfig().getHeaders());
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(this.headers)) {
|
|
||||||
setHeader(httpSamplerTree, this.headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断是否要开启DNS
|
//判断是否要开启DNS
|
||||||
if (config != null && config.getConfig() != null && config.getConfig().getCommonConfig() != null
|
if (config != null && config.getConfig() != null && config.getConfig().getCommonConfig() != null
|
||||||
|
|
Loading…
Reference in New Issue