fix(接口定义): 修复导入JMX的场景DELETE请求处理问题

--bug=1016235 --user=王孝刚 【接口测试】导入JMX的场景,DELETE请求处理问题
https://www.tapd.cn/55049933/s/1232429
This commit is contained in:
wxg0103 2022-08-24 16:03:08 +08:00 committed by f2c-ci-robot[bot]
parent 564840def2
commit e06e93d484
1 changed files with 3 additions and 8 deletions

View File

@ -49,6 +49,7 @@ import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.TestElement;
import org.apache.jorphan.collections.HashTree; import org.apache.jorphan.collections.HashTree;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -405,7 +406,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
if (urlObject.getPort() > 0 && urlObject.getPort() == 10990 && StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) { if (urlObject.getPort() > 0 && urlObject.getPort() == 10990 && StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
sampler.setProperty("HTTPSampler.port", this.getPort()); sampler.setProperty("HTTPSampler.port", this.getPort());
} else { } else if (urlObject.getPort() != -1) {
sampler.setPort(urlObject.getPort()); sampler.setPort(urlObject.getPort());
} }
sampler.setProtocol(urlObject.getProtocol()); sampler.setProtocol(urlObject.getProtocol());
@ -457,12 +458,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
if (!path.startsWith("/")) { if (!path.startsWith("/")) {
path = "/" + path; path = "/" + path;
} }
String port = sampler.getPort() != 80 ? ":" + sampler.getPort() : "";
if (StringUtils.equals("https", sampler.getProtocol()) && sampler.getPort() == 443) {
// 解决https delete请求时path路径带443端口请求头的host会变成域名加443
port = "";
}
path = sampler.getProtocol() + "://" + sampler.getDomain() + port + path;
} }
sampler.setProperty("HTTPSampler.path", path); sampler.setProperty("HTTPSampler.path", path);
} }
@ -481,7 +476,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8")); sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8"));
if (urlObject.getPort() > 0 && urlObject.getPort() == 10990 && StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) { if (urlObject.getPort() > 0 && urlObject.getPort() == 10990 && StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
sampler.setProperty("HTTPSampler.port", this.getPort()); sampler.setProperty("HTTPSampler.port", this.getPort());
} else { } else if (urlObject.getPort() != -1) {
sampler.setPort(urlObject.getPort()); sampler.setPort(urlObject.getPort());
} }
sampler.setProtocol(urlObject.getProtocol()); sampler.setProtocol(urlObject.getProtocol());