-
Notifications
You must be signed in to change notification settings - Fork 141
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?