-
-
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
Accept header strict #144
Accept header strict #144
Conversation
@@ -48,6 +48,11 @@ def before | |||
end | |||
end | |||
end | |||
|
|||
protected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small note, if ... && options[:versions]
is redundant with the if above it. This block is executed within the same if already.
This is definitely on the right path, but I think we shouldn't be eating an invalid accept header and issuing a 404. Shouldn't there be a 400 failure in this case? If so then I would split the condition and rewrite |
The RFC says this: If no Accept header field is present, then it is assumed that the client accepts all media types. If an Accept header field is present, and if the server cannot send a response which is acceptable according to the combined Accept field value, then the server SHOULD send a 406 (not acceptable) response. So I think the 404 is wrong. It should be a 406 both ways. |
Hi, thanks for comments I definitely agree with your thoughts. I've added some changes. What do you think? |
Very good. I'm merging this. |
Hey,
I was a bit confused about header versioning (for example #133) and I thought maybe it should be more strict.
When no Accept is passed like
I had default value
*/*
of accept header, so condition:was never true.
BTW.
Test case covered only this scenario:
I've added few more tests.