You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flip DefaultQueryEncoder to RFC3986QueryEncoder (space as %20) in v1.10.0 #189
runtime.DefaultQueryEncoder currently defaults to NetURLQueryEncoder, which encodes a space in query parameters as + (Go's net/url / application/x-www-form-urlencoded behavior). Strict RFC 3986 servers (some OData implementations, for example) reject or mis-decode +, and users have to opt in to RFC3986QueryEncoder to get %20.
OpenAPI query parameters default to style: form, which is defined in terms of RFC 6570 URI Templates. That expansion encodes a space as %20; + is only part of application/x-www-form-urlencoded, which OpenAPI associates with request bodies, not the query component.
%20 is the safer choice: every parser that accepts + as a space also accepts %20, but not the other way around.
This is a change in default client behavior, so it will go out in a minor release and be called out in the release notes. Anyone who depends on the old encoding can restore it at program initialization:
Activity