Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebClient no longer encodes query parameters [SPR-17532] #22064

spring-issuemaster opened this issue Nov 22, 2018 · 1 comment

WebClient no longer encodes query parameters [SPR-17532] #22064

spring-issuemaster opened this issue Nov 22, 2018 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Nov 22, 2018

ShaManHFel opened SPR-17532 and commented

The following sample code used to work in 5.0.8 but stopped working in 5.1.2:


.uri(builder -> builder
*.queryParam("q", "some spaces in the value")*


In 5.0.8 the result from this code was the following call:

GET /search?q=some%20spaces%20in%20the%20value HTTP/1.1
user-agent: ReactorNetty/0.7.8.RELEASE
host: [](

In 5.1.2 the result is:

Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in query at index 36: spaces in the value
at org.springframework.web.util.DefaultUriBuilderFactory$DefaultUriBuilder.createUri(
at org.springframework.web.util.DefaultUriBuilderFactory$
at com.vmware.identity.SpringBug.lambda$main$0(
at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultRequestBodyUriSpec.uri(
at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultRequestBodyUriSpec.uri(
at com.vmware.identity.SpringBug.main(
Caused by: Illegal character in query at index 36: spaces in the value
... 6 more

As evident from the error, the queryParam() method no longer encodes the query parameter values. This seems to be caused by a change in DefaultUriBuilderFactory where the default encoding mode was changed ``to EncodingMode.TEMPLATE_AND_VALUES.

Affects: 5.1.2

Issue Links:

  • #21997 WebClient's UriBuilder option should encode path parameters passed into build ("duplicates")

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 23, 2018

Rossen Stoyanchev commented

This is another variation on the same root cause as #21997. It works as expected with the current 5.1.3 snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.