-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Returning an empty hash in a HTTP delete results in an exception #1768
Comments
When investigating in the grape code, I see that inside_route wil check for a value in the body using .present? This will return false if an empty hash is used. I'm not sure if this should be the case. Returning an empty json object is done returning |
Interesting, I think this is a bug. Try writing a test for it, maybe a fix? |
I love to get some feedback. As a grape rookie, I hope I'm on the right track. |
After upgrading to Grape >= 0.19.1, the default status code for DELETE is now 204 instead of 200.
When returning a response which is not empty (for example
{'key'=>'value'}
, a 200 is returned with the correct response body.When a non empty hash is returned on webrick (default development rails server) this goes well: the hash is returned. However, if an empty hash is provided
{}
, it results in an exception:with the following output (http 500):
Adding an explicit status of 200 solves this:
Is this issue known, can someone confirm this and can it be solved in some way?
The text was updated successfully, but these errors were encountered: