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 5ffb469dca..a48936b2b4 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 @@ -421,14 +421,15 @@ public class MsHTTPSamplerProxy extends MsTestElement { if (StringUtils.isNotBlank(this.getPath())) { envPath += this.getPath(); } + sampler.setPort(httpConfig.getPort()); if (StringUtils.isNotEmpty(httpConfig.getDomain())) { sampler.setDomain(URLDecoder.decode(httpConfig.getDomain(), "UTF-8")); sampler.setProtocol(httpConfig.getProtocol()); } else { sampler.setDomain(""); sampler.setProtocol(""); + sampler.setPort(-1); } - sampler.setPort(httpConfig.getPort()); } else { URL urlObject = new URL(this.path); envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getFile();