fix(接口测试): 自定义请求接口覆盖率计算问题

--bug=1026406 --user=宋昌昌 【接口测试】未开启url可重复-场景用例数量统计-接口覆盖率有误 https://www.tapd.cn/55049933/s/1376830
This commit is contained in:
song-cc-rock 2023-05-30 16:40:56 +08:00 committed by fit2-zhao
parent 402abd81bc
commit 0614b47c14
1 changed files with 11 additions and 0 deletions

View File

@ -753,9 +753,20 @@ public class MockApiUtils {
return true;
}
}
// 去除URL中前缀后匹配
return isPathMatchWithoutPrefix(path, url);
}
}
}
return false;
}
public static boolean isPathMatchWithoutPrefix(String path, String url) {
String pathNoProtocol = path.replaceAll("http[s]?://", "");
int firstIndex = pathNoProtocol.indexOf("/");
if (firstIndex > 0) {
pathNoProtocol = pathNoProtocol.substring(firstIndex);
}
return StringUtils.equalsAny(pathNoProtocol, url, "/" + url);
}
}