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

HttpClient incorrectly encodes query params containing spaces with + and not %20 #11434

Open
jamesdh opened this issue Dec 12, 2024 · 0 comments · May be fixed by #11513
Open

HttpClient incorrectly encodes query params containing spaces with + and not %20 #11434

jamesdh opened this issue Dec 12, 2024 · 0 comments · May be fixed by #11513

Comments

@jamesdh
Copy link

jamesdh commented Dec 12, 2024

Expected Behavior

When using Micronaut's HttpClient to make a request to an endpoint using query params that contain spaces, the spaces are correctly encoded as %20 per RFC3986 (URI Generic Syntax).

Actual Behaviour

The spaces are encoded as +. That's because DefaultUriBuilder uses java.net.URLEncoder for query parameter encoding, which in turn is based off of the W3C's HTML 4 specification and subsequently encodes spaces as +

See this StackOverflow answer for a better understanding of some of the confusion. For reference, Spring's UriUtils is correctly based on RFC3986

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

4.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant