fix(接口测试): 修复DELETE请求接口使用变量作为域名的场景URL拼接错误问题
--bug=1012987 --user=赵勇 [接口测试]github#13239DELETE方法接口使用变量作为域名的场景URL拼接错误 https://www.tapd.cn/55049933/s/1152822
This commit is contained in:
parent
d8bc177b21
commit
ced328afce
|
@ -312,7 +312,7 @@ public class ElementUtil {
|
|||
}
|
||||
} else if (element.getString("type").equals("HTTPSamplerProxy")) {
|
||||
if (element.getString("authManager") != null) {
|
||||
JSONObject authManager = JSON.parseObject(element.getString("authManager"),Feature.DisableSpecialKeyDetect);
|
||||
JSONObject authManager = JSON.parseObject(element.getString("authManager"), Feature.DisableSpecialKeyDetect);
|
||||
if (authManager != null && authManager.get("clazzName") == null) {
|
||||
authManager.fluentPut("clazzName", clazzMap.get(authManager.getString("type")));
|
||||
element.fluentPut("authManager", authManager);
|
||||
|
@ -390,7 +390,7 @@ public class ElementUtil {
|
|||
if (StringUtils.equals(environmentType, EnvironmentType.GROUP.name())) {
|
||||
environmentMap = environmentGroupProjectService.getEnvMap(environmentGroupId);
|
||||
} else if (StringUtils.equals(environmentType, EnvironmentType.JSON.name())) {
|
||||
environmentMap = JSON.parseObject(environmentJson, Map.class,Feature.DisableSpecialKeyDetect);
|
||||
environmentMap = JSON.parseObject(environmentJson, Map.class, Feature.DisableSpecialKeyDetect);
|
||||
}
|
||||
Map<String, EnvironmentConfig> envConfig = new HashMap<>(16);
|
||||
if (environmentMap != null && !environmentMap.isEmpty()) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
// 非导出操作,且不是启用状态则跳过执行Ms
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}else if(config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())){
|
||||
} else if (config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())) {
|
||||
this.setName(config.getOperatingSampleTestName());
|
||||
}
|
||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||
|
@ -188,7 +188,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
setSamplerPath(config, httpConfig, sampler);
|
||||
|
||||
// 请求体处理
|
||||
if (this.body != null && StringUtils.equalsAnyIgnoreCase(method,"POST","PUT","PATCH")) {
|
||||
if (this.body != null && StringUtils.equalsAnyIgnoreCase(method, "POST", "PUT", "PATCH")) {
|
||||
List<KeyValue> bodyParams = this.body.getBodyParams(sampler, this.getId());
|
||||
if (StringUtils.isNotEmpty(this.body.getType()) && "Form Data".equals(this.body.getType())) {
|
||||
AtomicBoolean kvIsEmpty = new AtomicBoolean(true);
|
||||
|
@ -370,7 +370,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
httpConfig.setGlobalScriptConfig(environmentConfig.getGlobalScriptConfig());
|
||||
httpConfig.setAssertions(environmentConfig.getAssertions());
|
||||
if (environmentConfig.isUseErrorCode()) {
|
||||
httpConfig.setErrorReportAssertions(HashTreeUtil.getErrorReportByProjectId(this.getProjectId(),environmentConfig.isHigherThanSuccess(),environmentConfig.isHigherThanError()));
|
||||
httpConfig.setErrorReportAssertions(HashTreeUtil.getErrorReportByProjectId(this.getProjectId(), environmentConfig.isHigherThanSuccess(), environmentConfig.isHigherThanError()));
|
||||
}
|
||||
return httpConfig;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
Loading…
Reference in New Issue