fix(接口测试): 修复DELETE请求接口使用变量作为域名的场景URL拼接错误问题

--bug=1012987 --user=赵勇 [接口测试]github#13239DELETE方法接口使用变量作为域名的场景URL拼接错误 https://www.tapd.cn/55049933/s/1152822
This commit is contained in:
fit2-zhao 2022-05-05 16:07:56 +08:00 committed by halo-ci-bot[bot]
parent b2721483d1
commit b5f98492ca
3 changed files with 11 additions and 6 deletions

View File

@ -422,6 +422,8 @@ public class ElementUtil {
httpSamplerProxy.toHashTree(tmpHashTree, null, msParameter);
if (tmpHashTree != null && tmpHashTree.getArray().length > 0) {
HTTPSamplerProxy object = (HTTPSamplerProxy) tmpHashTree.getArray()[0];
// 清空Domain
element.fluentPut("domain", "");
if (object != null && StringUtils.isNotEmpty(object.getDomain())) {
element.fluentPut("domain", StringUtils.isNotEmpty(object.getProtocol()) ? object.getProtocol() + "://" + object.getDomain() : object.getDomain());
}

View File

@ -453,7 +453,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
if (CollectionUtils.isNotEmpty(this.getArguments())) {
String path = postQueryParameters(envPath);
if (HTTPConstants.DELETE.equals(this.getMethod()) && !path.startsWith("${")) {
if (HTTPConstants.DELETE.equals(this.getMethod()) && !path.startsWith("${") && !path.startsWith("/${")) {
if (!path.startsWith("/")) {
path = "/" + path;
}

View File

@ -748,6 +748,8 @@ export default {
if (item && map.has(item.resourceId)) {
item.domain = map.get(item.resourceId);
item.resourceId = getUUID();
}else{
item.domain = "";
}
if (item && item.hashTree && item.hashTree.length > 0) {
this.margeDomain(item.hashTree, map);
@ -1269,6 +1271,7 @@ export default {
request.versionEnable = item.versionEnable;
request.versionId = item.versionId;
request.versionName = item.versionName;
request.domain = "";
request.requestResult = [];
if (!request.url) {
request.url = "";