-
-
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
Can't issue HEAD requests to a GET endpoint #190
Comments
Lets close this and let everyone comment on #189 which fixes the issue. |
Can we reopen this? #189 and #190 are separate issues. #189 fixes the fact that HEAD requests can return a body. #190 brings up the fact that you can't issue a HEAD request to a GET endpoint and get identical responses. E.g., # in a grape api
get '/test' do
'hello world'
end The GET will return a 200 and the HEAD will return a 404:
This means that issuing |
You're right, reopening. |
I read the spec and I think you're right. If you want to make a proper pull request that has all specs passing (including your new one), will be happy to merge. Don't forget to update CHANGELOG. |
…ethod will also be added automatically.
When you add a GET route for a resource, a route for the HEAD method will now also be added automatically. You can disable this with |
I'm not sure if this bug belongs here or upstream with rack-mount (https://github.com/josh/rack-mount), but HTTP spec is pretty clear about responses to HEAD being identical to GET (less the response body):
—http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4
Below is a basic diff with a spec that fails (not sure if the response should be be nil or an empty string, though).
A potential fix (without modifying rack-mount) would be this diff:
This diff doesn't address the issue raised in #189, but we could fix that, as well. This diff also breaks a lot of specs.
Any thoughts on how/where the logic should be implemented? I've pinged @josh to see if he thinks any of it belongs in rack-mount.
The text was updated successfully, but these errors were encountered: