fix(接口测试): 优化接口路径的匹配方法

This commit is contained in:
Jianguo-Genius 2024-09-06 16:24:02 +08:00 committed by 建国
parent 28d31bf6e7
commit 2a837d6342
2 changed files with 3 additions and 3 deletions

View File

@ -719,7 +719,7 @@ public class MockApiUtils {
if (CollectionUtils.isEmpty(urlList)) { if (CollectionUtils.isEmpty(urlList)) {
return false; return false;
} }
String urlSuffix = url; String urlSuffix = url.trim();
if (urlSuffix.startsWith("/")) { if (urlSuffix.startsWith("/")) {
urlSuffix = urlSuffix.substring(1); urlSuffix = urlSuffix.substring(1);
} }

View File

@ -2332,10 +2332,10 @@ public class ApiScenarioService {
list.forEach(item -> { list.forEach(item -> {
String method = item.getMethod() == null ? "MS_NOT_HTTP" : item.getMethod(); String method = item.getMethod() == null ? "MS_NOT_HTTP" : item.getMethod();
if (returnMap.containsKey(method)) { if (returnMap.containsKey(method)) {
returnMap.get(method).put(item.getReferenceId(), item.getUrl()); returnMap.get(method).put(item.getReferenceId(), StringUtils.trim(item.getUrl()));
} else { } else {
Map<String, String> urlMap = new HashMap<>() {{ Map<String, String> urlMap = new HashMap<>() {{
this.put(item.getReferenceId(), item.getUrl()); this.put(item.getReferenceId(), StringUtils.trim(item.getUrl()));
}}; }};
returnMap.put(method, urlMap); returnMap.put(method, urlMap);
} }