[Fix] 修复 Relations 端点路由逻辑 - 使用 Method 枚举比较#167
Merged
Conversation
## 问题描述
访问 `/issues/{id}/relations.json` 时返回 405 Method Not Allowed 错误。
## 根本原因
`session.getMethod()` 返回的是 `NanoHTTPD.Method` 枚举类型,而不是字符串。
原代码中使用 `"GET".equals(method)` 进行比较,永远返回 false。
## 修复内容
修改路由逻辑,使用 `Method.GET.equals(method)` 进行枚举比较。
## 技术细节
- `Method.GET.equals(method)` - 正确比较 GET 请求
- `Method.POST.equals(method)` - 正确比较 POST 请求
- `Method.DELETE.equals(method)` - 正确比较 DELETE 请求
## 关联任务
- #791551456664 - [Feature] 支持 /issues/{id}/relations.json 路径以管理任务阻塞关系
hxcan
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
访问
/issues/{id}/relations.json时返回 405 Method Not Allowed 错误。根本原因
session.getMethod()返回的是NanoHTTPD.Method枚举类型,而不是字符串。原代码中使用
"GET".equals(method)进行比较,永远返回 false。修复内容
修改路由逻辑,使用
Method.GET.equals(method)进行枚举比较。技术细节
Method.GET.equals(method)- 正确比较 GET 请求Method.POST.equals(method)- 正确比较 POST 请求Method.DELETE.equals(method)- 正确比较 DELETE 请求关联任务