SPR-15140: @RequestParam injects a raw undecoded string for reactive HTTP requests #1297
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.
When using spring-web-reactive, %-encoded strings were injected as-is into @RequestParam variables, which does not coincide with spring-webmvc behaviour.
Example:
curl -s 'http://localhost:8080/search?q=%20%2B+%C3%A0'
Spring Web Reactive:
%20%2B+%C3%A0
Spring Web MVC:
(space)+ à
(
(space)
is a space character, GitHub seems to remove leading whitespaces...)The cause is that
AbstractServerHttpRequest.getQueryParams()
is returning undecoded name-value pairs, while the interface methodServerHttpRequest.getQueryParams()
specifies (in javadoc) to return decoded ones.This commit fixed the
AbstractServerHttpRequest
implementation to correctly returndecoded name-value pairs and added an unit test.
https://jira.spring.io/browse/SPR-15140
(I have signed the CLA.)