Skip to content

fix(core): map HEAD requests to GET in method cache (v2.x) - #15865

Merged
KomachiSion merged 1 commit into
alibaba:v2.x-developfrom
KomachiSion:codex/fix-head-method-cache-v2
Sep 20, 2026
Merged

KomachiSion merged 1 commit into
alibaba:v2.x-developfrom
KomachiSion:codex/fix-head-method-cache-v2

Conversation

@KomachiSion

Copy link
Copy Markdown
Collaborator

What is the purpose of the change

Resolve HEAD requests to their GET controller method in ControllerMethodsCache on v2.x. Previously, a HEAD request to a GET mapping returned no cached method even though Spring MVC accepts the request.

Brief changelog

  • Normalize HEAD to GET when constructing the lookup key, preserving parameter matching and the original servlet request method.
  • Add JUnit 5 regressions for HEAD and GET lookup, matching and mismatching parameters, POST behavior, and missing mappings.

Verifying this change

  • The regression tests reproduced both HEAD lookup failures before the fix.
  • Run with Java 8: mvn -B -pl core -am clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=false -DskipTests=false -Dtest='ControllerMethodsCacheTest,ParamRequestConditionTest,PathRequestConditionTest' -Dsurefire.failIfNoSpecifiedTests=false.
  • All 10 selected tests passed; the complete core dependency reactor passed packaging, RAT, Checkstyle, and FindBugs execution.
  • Spotless apply/check with a temporary unused-import configuration for the two changed Java files; this branch has no configured Spotless formatter. The branch's Checkstyle runs as part of Maven validation.

No endpoint or public SDK contract changes.

@KomachiSion KomachiSion added this to the 2.5.5 milestone Sep 20, 2026
@KomachiSion KomachiSion added kind/bug Category issues or prs related to bug. area/plugin area/Nacos Core labels Sep 20, 2026
@KomachiSion
KomachiSion merged commit 72ffa3e into alibaba:v2.x-develop Sep 20, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API、新增配置参数、修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@KomachiSion
KomachiSion deleted the codex/fix-head-method-cache-v2 branch September 20, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/Nacos Core area/plugin kind/bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant