mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 04:28:51 +08:00
Update ElementUtil.java
fixed 设置引用环境,没有带出来环境的url前缀。 重现步骤: 为环境指定http协议,域名,端口 为场景指定环境为上述环境 该场景中有2个自定义请求,第一个没有设置跟随环境, 第二个点跟随环境按钮时无法带出环境的url前缀。 原因:处理第一个自定义请求时,抛出空指针异常 修复方法: io.metersphere.api.dto.definition.request.ElementUtil#dataSetDomain 中判断 getIsRefEnvironment是否为true时先判断是否是null。BooleanUtils.isTrue(httpSamplerProxy.getIsRefEnvironment()))
This commit is contained in:
parent
2678e5492c
commit
8a280a74db
@ -32,6 +32,7 @@ import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.service.EnvironmentGroupProjectService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
import org.apache.jmeter.config.CSVDataSet;
|
||||
@ -417,7 +418,7 @@ public class ElementUtil {
|
||||
} else if (element != null && element.get("type").toString().equals("HTTPSamplerProxy")) {
|
||||
MsHTTPSamplerProxy httpSamplerProxy = JSON.toJavaObject(element, MsHTTPSamplerProxy.class);
|
||||
if (httpSamplerProxy != null
|
||||
&& (!httpSamplerProxy.isCustomizeReq() || (httpSamplerProxy.isCustomizeReq() && httpSamplerProxy.getIsRefEnvironment()))) {
|
||||
&& (!httpSamplerProxy.isCustomizeReq() || (httpSamplerProxy.isCustomizeReq() && BooleanUtils.isTrue(httpSamplerProxy.getIsRefEnvironment())))) {
|
||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||
|
Loading…
Reference in New Issue
Block a user