Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom body parser issue #1377

Open
krzykamil opened this issue Apr 3, 2024 · 0 comments
Open

Custom body parser issue #1377

krzykamil opened this issue Apr 3, 2024 · 0 comments

Comments

@krzykamil
Copy link

Moving this https://discourse.hanamirb.org/t/custom-body-parser-from-hanami-2-1-guides/929/4 to an issue, since I believe this is an error. Especially after testing a direct example from GETTING STARTED guide
https://guides.hanamirb.org/v2.1/actions/parameters/#body-parsers
https://github.com/hanami/router?tab=readme-ov-file#custom-parsers

Those two examples seem to be broken. I tested them and the error produced is as in the forum thread.
I've traced the error down to:

hanami-router-2.1.0/lib/hanami/middleware/body_parser/class_interface.rb:54

        def build_parsers(parser_specs, registry = {})
          return DEFAULT_BODY_PARSERS if parser_specs.empty?

And with the given examples, the error disappears when the custom parser is wrapped in an array, but obviously this is not the actual solution, since we would want to just pass an parser that handles a given format.

I would like to work on it if this is an actual bug, but would prefer to get a confirmation since I am not so sure about it.

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

No branches or pull requests

1 participant