Skip to content

Remove redundant matching of multipart content-type.#480

Merged
ahx merged 1 commit into
mainfrom
register-request-body-parser
May 28, 2026
Merged

Remove redundant matching of multipart content-type.#480
ahx merged 1 commit into
mainfrom
register-request-body-parser

Conversation

@ahx
Copy link
Copy Markdown
Owner

@ahx ahx commented May 28, 2026

Lookup of request body parser gets an optional options hash now. If you want to register new body parsers, there are two options

  1. passing a callable register('application/x-www-form-urlencoded', lambda(&:POST))
  2. passing a class that accepts an options hash in the initializer register(%r{\Amultipart/form-data\b}i, MultipartBodyParser)

Related to https://github.com/ahx/openapi_first/pull/478, whi, but keeping both parser shapes (callable and class) functional

Lookup of request body parser gets an optional options hash now.
If you want to register new body parsers, there are two options

1. passing a callable
   register('application/x-www-form-urlencoded', lambda(&:POST))
2. passing a class that accepts an options hash in the initializer
   register(%r{\Amultipart/form-data\b}i, MultipartBodyParser)
@ahx ahx marked this pull request as ready for review May 28, 2026 21:04
@ahx ahx merged commit 0ff0cc4 into main May 28, 2026
32 checks passed
@ahx ahx deleted the register-request-body-parser branch May 28, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant