refactor(接口测试): 优化http变量取ip配置的逻辑

This commit is contained in:
wxg0103 2023-03-31 19:24:04 +08:00 committed by fit2-zhao
parent 662e8e28c3
commit 1440e64a73
1 changed files with 5 additions and 2 deletions

View File

@ -425,10 +425,13 @@ public class MsHTTPSamplerProxy extends MsTestElement {
envPath += this.getPath();
}
sampler.setPort(httpConfig.getPort());
if (StringUtils.isNotEmpty(httpConfig.getDomain())) {
if (httpConfig.getDomain().startsWith("${")){
sampler.setProtocol(httpConfig.getProtocol());
envPath = StringUtils.isNotBlank(this.path) ? StringUtils.join(httpConfig.getSocket(), this.path) : url;
} else if (StringUtils.isNotEmpty(httpConfig.getDomain())) {
sampler.setDomain(URLDecoder.decode(httpConfig.getDomain(), StandardCharsets.UTF_8.name()));
sampler.setProtocol(httpConfig.getProtocol());
} else {
} else {
sampler.setDomain("");
sampler.setProtocol("");
sampler.setPort(-1);