fix(接口测试): 修复快捷调试端口丢失的缺陷
--bug=1028194 --user=王孝刚 【接口测试】github#25927,【接口测试】快捷调试接口会出现端口丢失问题 https://www.tapd.cn/55049933/s/1399277
This commit is contained in:
parent
8bcabecac9
commit
7382b2ea08
|
@ -103,7 +103,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
} else if (config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())) {
|
} else if (config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())) {
|
||||||
this.setName(config.getOperatingSampleTestName());
|
this.setName(config.getOperatingSampleTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||||
boolean ref = this.setRefElement();
|
boolean ref = this.setRefElement();
|
||||||
if (!ref) {
|
if (!ref) {
|
||||||
|
@ -405,11 +405,12 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
String envPath = "";
|
String envPath = "";
|
||||||
try {
|
try {
|
||||||
URL urlObject = new URL(url);
|
URL urlObject = new URL(url);
|
||||||
if (url.contains("${")){
|
if (url.contains("${")) {
|
||||||
envPath = url;
|
envPath = url;
|
||||||
} else {
|
} else {
|
||||||
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), StandardCharsets.UTF_8.name()));
|
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), StandardCharsets.UTF_8.name()));
|
||||||
envPath = urlObject.getPath();
|
envPath = urlObject.getPath();
|
||||||
|
sampler.setPort(urlObject.getPort());
|
||||||
}
|
}
|
||||||
sampler.setProtocol(urlObject.getProtocol());
|
sampler.setProtocol(urlObject.getProtocol());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -482,7 +483,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
try {
|
try {
|
||||||
URL urlObject = new URL(url);
|
URL urlObject = new URL(url);
|
||||||
String envPath;
|
String envPath;
|
||||||
if (url.contains("${")){
|
if (url.contains("${")) {
|
||||||
envPath = url;
|
envPath = url;
|
||||||
} else {
|
} else {
|
||||||
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), StandardCharsets.UTF_8.name()));
|
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), StandardCharsets.UTF_8.name()));
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class MockConfigService {
|
||||||
|
|
||||||
public List<MockConfigImportDTO> selectMockExpectConfigByApiIdIn(List<String> apiIds) {
|
public List<MockConfigImportDTO> selectMockExpectConfigByApiIdIn(List<String> apiIds) {
|
||||||
if (CollectionUtils.isNotEmpty(apiIds)) {
|
if (CollectionUtils.isNotEmpty(apiIds)) {
|
||||||
return extMockExpectConfigMapper.selectByApiIdIn(apiIds);
|
return extMockExpectConfigMapper.selectByApiIdIn(apiIds);
|
||||||
} else {
|
} else {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
@ -848,7 +848,7 @@ public class MockConfigService {
|
||||||
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
|
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
|
||||||
LogUtil.info("Mock urlSuffix:{}", urlSuffix);
|
LogUtil.info("Mock urlSuffix:{}", urlSuffix);
|
||||||
LogUtil.info("Mock requestHeaderMap:{}", requestHeaderMap);
|
LogUtil.info("Mock requestHeaderMap:{}", requestHeaderMap);
|
||||||
LogUtil.info("Mock requestMockParams:{}", requestMockParams);
|
LogUtil.info("Mock requestMockParams:{}", JSON.toJSONString(requestMockParams));
|
||||||
List<ApiDefinitionWithBLOBs> qualifiedApiList = apiDefinitionService.preparedUrl(project.getId(), method, urlSuffix, requestHeaderMap.get(MockApiHeaders.MOCK_API_RESOURCE_ID));
|
List<ApiDefinitionWithBLOBs> qualifiedApiList = apiDefinitionService.preparedUrl(project.getId(), method, urlSuffix, requestHeaderMap.get(MockApiHeaders.MOCK_API_RESOURCE_ID));
|
||||||
for (ApiDefinitionWithBLOBs api : qualifiedApiList) {
|
for (ApiDefinitionWithBLOBs api : qualifiedApiList) {
|
||||||
if (StringUtils.isEmpty(returnStr)) {
|
if (StringUtils.isEmpty(returnStr)) {
|
||||||
|
@ -885,7 +885,7 @@ public class MockConfigService {
|
||||||
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
|
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
|
||||||
LogUtil.info("Mock urlSuffix:{}", urlSuffix);
|
LogUtil.info("Mock urlSuffix:{}", urlSuffix);
|
||||||
LogUtil.info("Mock requestHeaderMap:{}", requestHeaderMap);
|
LogUtil.info("Mock requestHeaderMap:{}", requestHeaderMap);
|
||||||
LogUtil.info("Mock requestMockParams:{}", requestMockParams);
|
LogUtil.info("Mock requestMockParams:{}", JSON.toJSONString(requestMockParams));
|
||||||
List<ApiDefinitionWithBLOBs> qualifiedApiList = apiDefinitionService.preparedUrl(project.getId(), method, urlSuffix, requestHeaderMap.get(MockApiHeaders.MOCK_API_RESOURCE_ID));
|
List<ApiDefinitionWithBLOBs> qualifiedApiList = apiDefinitionService.preparedUrl(project.getId(), method, urlSuffix, requestHeaderMap.get(MockApiHeaders.MOCK_API_RESOURCE_ID));
|
||||||
/*
|
/*
|
||||||
GET/DELETE 这种通过url穿参数的接口,在接口路径相同的情况下可能会出现这样的情况:
|
GET/DELETE 这种通过url穿参数的接口,在接口路径相同的情况下可能会出现这样的情况:
|
||||||
|
|
|
@ -278,6 +278,9 @@ export default {
|
||||||
this.debugForm.path = url;
|
this.debugForm.path = url;
|
||||||
this.debugForm.url = url;
|
this.debugForm.url = url;
|
||||||
}
|
}
|
||||||
|
if (!this.debugForm.url.startsWith('http') && !this.debugForm.url.startsWith('https')) {
|
||||||
|
this.debugForm.url = 'http://' + this.debugForm.url;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getURL(urlStr) {
|
getURL(urlStr) {
|
||||||
try {
|
try {
|
||||||
|
@ -304,7 +307,7 @@ export default {
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!urlStr.startsWith("http") || !urlStr.startsWith("https")) {
|
if (!urlStr.startsWith("http") && !urlStr.startsWith("https")) {
|
||||||
urlStr = "http://" + urlStr;
|
urlStr = "http://" + urlStr;
|
||||||
}
|
}
|
||||||
return urlStr;
|
return urlStr;
|
||||||
|
|
Loading…
Reference in New Issue