Skip to content

Commit 8e42cf1

Browse files
authored
Merge pull request #13 from Chave0v0/dev
修复已知bug
2 parents 0437776 + d6c4e3e commit 8e42cf1

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/main/java/com/chave/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void initialize(MontoyaApi montoyaApi) {
2121
Logging log = API.logging();
2222

2323
API.extension().setName("API Highlighter");
24-
log.logToOutput("API Highlighter v2.1.1\n\n" +
24+
log.logToOutput("API Highlighter v2.1.2\n\n" +
2525
"Rebuild: Chave\n" +
2626
"GitHub: https://github.com/Chave0v0/API-Highlighter\n");
2727

src/main/java/com/chave/service/APIMatchService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public HashMap<String, Object> semiFuzzMatch(HttpRequest request) {
9494

9595
try {
9696
// 声明没有 PathVariable 情况下的正则
97-
pattern = Pattern.compile("^(/[^/]+)?" + apiItem.getPath() + "(/.*)?$", Pattern.CASE_INSENSITIVE);
97+
pattern = Pattern.compile("^(/[^/]+)*" + apiItem.getPath() + "(/.*)?$", Pattern.CASE_INSENSITIVE);
9898
} catch (Exception e) {
9999
// 如果正则编译捕获异常,并且有"{",认为是有PathVariable的情况,重新生成正则。
100100
if (apiItem.getPath().contains("{")) {
101-
pattern = Pattern.compile("^(/[^/]+)?" + Util.convertPathToRegex(apiItem.getPath()) + "(/.*)?$", Pattern.CASE_INSENSITIVE);
101+
pattern = Pattern.compile("^(/[^/]+)*" + Util.convertPathToRegex(apiItem.getPath()) + "(/.*)?$", Pattern.CASE_INSENSITIVE);
102102
} else {
103103
// 其他情况认为是预期外的异常,直接输出log
104104
log.logToError("半精确匹配出现异常" + e.getCause());

src/main/java/com/chave/ui/HighlighterMainUI.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,10 @@ public void actionPerformed(ActionEvent e) {
406406
List<ProxyHttpRequestResponse> historyList = Main.API.proxy().history();
407407
// 检查history先清空所有result和found状态 重新记录
408408
for (APIItem apiItem : APIConfig.TARGET_API) {
409-
apiItem.setResult(null);
410-
apiItem.setIsFound(null);
409+
if (apiItem.getState().equals(Boolean.FALSE)) { // 仅重置未测试完成的接口result、IsFound信息
410+
apiItem.setResult(null);
411+
apiItem.setIsFound(null);
412+
}
411413
}
412414
for (ProxyHttpRequestResponse proxyHttpRequestResponse : historyList) {
413415
// 获取要检查的request和response

0 commit comments

Comments
 (0)