diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 9a20645c6e..649d5d755d 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -254,10 +254,13 @@ public class MsHTTPSamplerProxy extends MsTestElement { if (CollectionUtils.isNotEmpty(hashTree)) { for (MsTestElement el : hashTree) { - if (this.getEnvironmentId() == null || el.getEnvironmentId() == null) { - el.setEnvironmentId(useEnvironment); + if(el.getEnvironmentId() == null){ + if(this.getEnvironmentId() == null){ + el.setEnvironmentId(useEnvironment); + }else{ + el.setEnvironmentId(this.getEnvironmentId()); + } } - el.toHashTree(httpSamplerTree, el.getHashTree(), config); } }