-
-
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
Using route :any
causes OPTIONS and HEAD requests to fail
#1056
Comments
You should turn it into a test, do GETs behave differently from HEADs? |
@dblock any suggestions as to where to start adding a test? If I understand your question right, then yes: HEAD behaves differently from GET. HEAD doesn't return any response body - only headers. It's so to speak a compacted request. Useful for checking if a cache is busted, and a new one should be fetched. |
For now just add a standalone test in https://github.com/intridea/grape/tree/master/spec/grape/integration. |
This illustrates the issue described in ruby-grape#1056 by adding a options and head request when the catch-all route is enabled.
This illustrates the issue described in ruby-grape#1056 by adding a options and head request when the catch-all route is enabled.
Yes. |
This illustrates the issue described in ruby-grape#1056 by adding a options and head request when the catch-all route is enabled.
This illustrates the issue described in ruby-grape#1056 by adding a options and head request when the catch-all route is enabled.
According to the documentation, any GET endpoint also serves OPTIONS and HEAD requests.
I would expect these to be hit before the
route :any
at the bottom of my api. But this isn't the case.Is this a bug or intentional? If it's intentional, what's the right way to catch stray requests without overriding OPTIONS and HEAD for the real endpoints?
Here is a demo api. I would expect this request to return the
Allow
header for the/names
endpoint. But instead it returnI'm not here
, which means it hits theroute :any
fallback.The text was updated successfully, but these errors were encountered: