WebFlux Cloud Foundry links endpoint includes query string from received request in resolved links#50008
Merged
wilkinsona merged 2 commits intospring-projects:3.5.xfrom Apr 10, 2026
Conversation
3d93917 to
0817f42
Compare
0817f42 to
eea1aa1
Compare
CloudFoundryLinksHandler passes request.getURI().toString() directly to EndpointLinksResolver.resolveLinks(), which includes the query string. This causes generated link hrefs to contain the query (for example, "/cfApplication?x=1/info"). The standard WebFlux and Cloud Foundry servlet siblings already strip the query before resolving links. Use UriComponentsBuilder.replaceQuery(null) to match the pattern used by WebFluxEndpointHandlerMapping and add a regression test for a query-string request. Signed-off-by: Lee JiWon <dlwldnjs1009@gmail.com> See spring-projectsgh-50008
This commit polishes the proposed test for the WebFlux Cloud Foundry endpoint. To protect against future regressions, it also adds tests for the general purpose links endpoints (WebFlux, Web MVC, and Jersey) and for the Web MVC Cloud Foundry endpoint. See spring-projectsgh-50008
eea1aa1 to
f63f6d7
Compare
Member
|
Thank you, @dlwldnjs1009. |
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.
Summary
CloudFoundryLinksHandler#linksincludes the request query string when resolving endpoint links/cfApplication?x=1/infoinstead of/cfApplication/info)UriComponentsBuilder.fromUri(...).replaceQuery(null)to strip the query, and the Cloud Foundry servlet sibling usesgetRequestURL()which excludes the query by Servlet specreplaceQuery(null)pattern and added a regression test verifyingself,info, andenvlink hrefs remain query-freeTest plan
CloudFoundryWebFluxEndpointIntegrationTestspasses (including newlinksToOtherEndpointsWithQueryStringShouldNotContainQueryInHref)checkFormatMainandcheckFormatTestpass