Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JSON body interaction #441

Open
Open
@renatolond

Description

Hey!

I have an issue that I think it's on committee's side, but I'm not sure.

So, I'm using Grape for my API, with rodauth+rodauth-oauth for the auth part.

Here's the issue: with grape reading the body, committee works fine. It seems grape rewinds the body before and after reading it, so it's ready for committee:
https://github.com/ruby-grape/grape/blob/master/lib/grape/middleware/formatter.rb#L86-L92

However, Roda doesn't if rack is >=3. https://github.com/jeremyevans/roda/blob/master/lib/roda/plugins/json_parser.rb#L89-L93

Now, the issue is that since committee does not rewind ahead of reading, it gets an empty body and assumes the lenght == 0 situation (and therefore, no params) and fails the validation: https://github.com/interagent/committee/blob/master/lib/committee/request_unpacker.rb#L81-L83

Adding a rewind before reading solves the issue, but I'm not sure it's the right way to go (I read the Rack spec but it's not clear to me if that rewind is meant to always work).

I thought I could take the grape route and rewind if the input responds to rewind (see #442), wdyt?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /