fix(接口测试): 修复接口执行模块匹配多出端口问题

--bug=1010400 --user=赵勇 【接口测试】环境模块匹配,匹配不到域名的接口,调试的时候多了个端口号 https://www.tapd.cn/55049933/s/1105831
This commit is contained in:
fit2-zhao 2022-02-18 16:35:06 +08:00 committed by fit2-zhao
parent 0ea9c0b748
commit b484e56eb5
1 changed files with 2 additions and 1 deletions

View File

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