Repository navigation
Decode + as a space in query items - #223
Open
nandan-varma wants to merge 2 commits into
Open
nandan-varma wants to merge 2 commits into
nandan-varma wants to merge 2 commits into
Conversation
OpenAPI 3.2 says an unencoded + in a query string means a space. The server now decodes it that way. %2B still decodes to +, and %20 still decodes to a space. Path parameters and headers are not changed. Fixes apple/swift-openapi-generator#965
The server now decodes + as a space in query items, so this middleware is not needed anymore. It still works, but it now shows a deprecation warning.
czechboy0
self-requested a review
October 8, 2026 10:02
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.
Motivation
OpenAPI 3.2 says that an unencoded
+in a query string should be decoded as a space.Some clients use
+when sending spaces, like Pythonrequests, JavaURLEncoder, and JavaScriptURLSearchParams. This previously requiredQuerySpaceNormalizingMiddleware.Fixes apple/swift-openapi-generator#965
Modifications
+as a space.QuerySpaceNormalizingMiddleware.Result
a+b→a ba%2Bb→a+ba%20b→a bBehavior change: if a server gets an unencoded
+and expects a literal+, it will now get a space.Test Plan
Added unit tests that fail without the fix.