Closed jgnagy closed 7 years ago
Same behavior with 2.3.3. Will try 2.4.0 shortly.
Same thing with 2.4.0.
Hi @jgnagy, thank you very much for the issue report. It looks like the Rack::Lint::InputWrapper request object doesn't respond to #size
, so Sinja sees an empty and therefore invalid payload. Let me take a look at Sinja's content?
helper to see if there's a better way to handle these types of inputs.
Ah, I see. Your demo app doesn't use rackup
, instead running app.rb
directly. My actual app uses several modular Sintra applications and uses rack to route the requests to them, so there is our difference.
Thank you for responding so quickly. Let me know if there is anything I can do to help, and I look forward to the fix so I can keep moving on my application.
Thanks!
I think that will do the trick. Add Sinja to your Gemfile (instead of gemspec) and point it at this repo. I'll release a new version of the gem that includes this fix a little later today or tomorrow. Thanks again for the report, and please feel free to reopen this issue if it's still not fixed (or open a new issue if you find anything else wrong).
I hate to be a pain, but I'm still getting the same results. I updated that test repo with the change (pointing directly to your master branch in the Gemfile) and I still get the send end result. Should I open a new issue?
You aren't being a pain at all. I missed something. I figured out a way to test it, now, so hopefully this issue won't reappear in the future. 😄 Thank you for your patience; would you please try again?
Looks like that fixed it in my test version (code pushed to that repo). I'll head back to my actual app and see if I have success there as well. Thanks again for the quick turnaround!
You're quite welcome. Sinja 1.2.4 is now available with the fix (and a number of other fixes and improvements). Thanks again for the report!
The issue seems to be that all my attempts to create new resources via the JSON API using sinja seem to not work. It is entirely possible that I'm doing something wrong, but I can't find it looking through both the README and demo app.
I created a repo with the most essential components of my app captured: https://github.com/jgnagy/test-api
Notice the /keys endpoint supports both
show
andcreate
. The show works fine, per this curl command:Which yields something like:
However, attempting to create a new resource via this curl command:
Returns the following:
I'm uncertain why this isn't working, and I've tried making additional Sinatra apps just passing "normal" JSON around and that works fine. When I involve sinja, it seems unhappy and I can't see why.
I'm using ruby 2.3.1 (about to upgrade ruby and see if that helps) via RVM on macOS.
I appreciate the help!