Repository navigation
feat: default query encoding to RFC 3986 (space as %20) - #190
Merged
Merged
Conversation
Closes: oapi-codegen#189 Flip `DefaultQueryEncoder` from `NetURLQueryEncoder` to `RFC3986QueryEncoder`, so generated clients encode a space in query parameters as `%20` instead of `+`. OpenAPI's default `style: form` for query parameters is defined by RFC 6570, which encodes a space as `%20`; `+` belongs to `application/x-www-form-urlencoded`, which applies to request bodies. Servers that accept `+` as a space also accept `%20`, but strict RFC 3986 servers reject `+`. This changes default client behavior. To restore the previous encoding, set `runtime.DefaultQueryEncoder = runtime.NetURLQueryEncoder{}` during program initialization. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Closes: #189
Flips
DefaultQueryEncoderfromNetURLQueryEncodertoRFC3986QueryEncoder, so generated clients encode a space in query parameters as%20instead of+.OpenAPI's default
style: formfor query parameters is defined by RFC 6570, which encodes a space as%20;+belongs toapplication/x-www-form-urlencoded, which applies to request bodies. Servers that accept+as a space also accept%20, but strict RFC 3986 servers reject+.This changes default client behavior and is intended for v1.10.0. To restore the previous encoding:
Path escaping and
application/x-www-form-urlencodedrequest bodies are unaffected.🤖 Generated with Claude Code