Use registered multipart/form-data parser#478
Merged
ahx merged 1 commit intoMay 26, 2026
Conversation
Owner
|
Hi. Thanks for the PR. This makes the whole story about request body parsers more coherent. This PR makes it apparent, that I got a bit lazy in #472 and vibe coded the thing, because I wanted to get the issue closed without looking more into finding a better interface that uses the same code path for content with "encoding" or without "encoding". |
Owner
|
Maybe we should change the interface for parsers to always pass an arbitrary class MyCustomMultipartBodyParser
def initialize(options={})
end
end
OpenapiFirst::RequestBodyParsers.register(
'multipart/form-data',
MyCustomMultipartBodyParser,
)
# … and internally it always calls `.new` on the class
RequestBodyParsers[content_type].new({encoding: …})This would mean an interface change from |
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.
With the changes made in #472,
openapi_firstwill now always useRequestBodyParsers::MultipartBodyParserto parse amultipart/form-datarequest. This PR makes it so that it will use the registered parser (which by default isRequestBodyParsers::MultipartBodyParser).This is to support any custom
'multipart/form-data'parsers that may have been registered. For example, withopenapi_firstwill now useMyCustomMultipartBodyParser.