-
-
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
Header versioning allows jibberish #124
Comments
The problem is that the
Any other ideas? |
I think perhaps if the Currently enabling the strict option and passing a blank accept header renders a 404. I think this should be extended as most of the time a client will send application/json or similar and get the default version. |
I think this is already taken care of in the Frontier branch: Specs have been added for it to if I am not mistaken |
@mariovisic I looked at it, and it seems I was partially wrong, the I for one think this is what I would expect when someone uses the accept header to select a version, especially when the subtype is already determined to be 'vnd'. just my opinion though :) |
Pull request #144 fixed some issues around this. 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 that's taken care of, a well formed, but an unacceptable Accept header will cause a 406. So what's left for this item? For gibberish Accept header I think Grape should return a 400 when used with |
Bump? Comments? |
I would like to see strict mean that the header must match one of the mounted versions, otherwise 406. |
I agree with @jpaas, our version header includes a format key and I would like it to return a 406 unless the accept header include the current vendor and format. |
This is what I expected after implementing versioning according to the README of grape. |
I am down with the above, PR someone please? |
Fixed in #1101 |
Hi Guys
Currently when header versioning is enabled (even with the strict option) sending a request without a valid vendor string will result in the first version being matched.
On line #37 here the loop will not run if the Accept header doesn't match the string.
https://github.com/intridea/grape/blob/master/lib/grape/middleware/versioner/header.rb#L37
This doesn't seem like the correct behaviour to me. Would it be better to render a 404 instead? If so then i'll see about adding a failing test + patch to solve the problem.
The text was updated successfully, but these errors were encountered: