Repository navigation
fix(client): encode query-param spaces as %20 instead of + (#626) - #664
Merged
dakrone merged 2 commits intoJun 23, 2026
Merged
Conversation
URLEncoder encodes a space as +, which is correct for an application/x-www-form-urlencoded body but not for the query component of a URI, where a space should be %20 (RFC 3986). generate-query-string is shared by both the form-params (body) and query-params (URI) paths, so the fix is applied only on the query-params path: every literal + is already percent-encoded as %2B at that point, so remaining + characters are encoded spaces and can be rewritten to %20. Form-param bodies are unchanged. Fixes dakrone#626.
Contributor
Author
|
Heads-up on CI: this branch targets |
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.
Fixes #626.
Spaces in
:query-paramsare encoded as+rather than%20.+is correct for anapplication/x-www-form-urlencodedbody, but in the query component of a URI a space should be%20(RFC 3986);+there is only conventionally - not standardly - read as a space.generate-query-stringis shared by both the form-params (body) and query-params (URI) paths, so the fix is applied only on the query-params path. By that point every literal+is already percent-encoded as%2B, so each remaining+is an encoded space and is rewritten to%20. Form-param bodies are left unchanged.This also matches the convention already used by
url-encode-illegal-charactersfor raw URL query strings ("Minimizes ambiguity by encoding space to %20").Tests: query params with spaces ->
%20; a literal+value stays%2B; form-param bodies still use+.