{"issue":{"created_at":"2011-11-23T14:55:26Z","state":"open","updated_at":"2011-11-23T15:27:03Z","user":{"gravatar_id":"30b5ee2acbd8700042040eb917e81572","id":389317,"url":"https://api.github.com/users/jwkoelewijn","login":"jwkoelewijn","avatar_url":"https://secure.gravatar.com/avatar/30b5ee2acbd8700042040eb917e81572?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":3,"body":"When no header is sent, but :using => :header is used, a 404 should be\r\nreturned, because this would mean no version is being selected","assignee":null,"id":2330331,"labels":[],"number":79,"pull_request":{"patch_url":"https://github.com/intridea/grape/pull/79.patch","html_url":"https://github.com/intridea/grape/pull/79","diff_url":"https://github.com/intridea/grape/pull/79.diff"},"title":"Return 404 if no header is sent, but header based version is used","closed_at":null,"html_url":"https://github.com/intridea/grape/issues/79","milestone":null,"url":"https://api.github.com/repos/intridea/grape/issues/79"},"action":"created","comment":{"created_at":"2011-11-23T15:27:03Z","updated_at":"2011-11-23T15:27:03Z","user":{"gravatar_id":"acd4b5803e806bf0ed70299f15cd6d18","id":19874,"url":"https://api.github.com/users/jch","login":"jch","avatar_url":"https://secure.gravatar.com/avatar/acd4b5803e806bf0ed70299f15cd6d18?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"I'm on the fence about this one.  If we follow the semantics of the Accept\nheader (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html), then not\nsetting an Accept header means the client can handle any representation the\nserver decides to respond with.  In this case, grape should return the\nfirst endpoint that doesn't return 404.\n\nOn the other hand, there's a good chance the client developer meant to\ninclude an Accept header, but forgot to.  I think a good way to solve both\nis to include a `:whiny` option when declaring versions:\n\n````\nclass API < Grape::API\n  # if whiny is set, and no accept header exists, return 404\n  version :v1, :using => :headers, :whiny => true\nend\n````\n\nThoughts?\n\nOn Wed, Nov 23, 2011 at 9:55 AM, jwkoelewijn <\nreply@reply.github.com\n> wrote:\n\n> When no header is sent, but :using => :header is used, a 404 should be\n> returned, because this would mean no version is being selected\n>\n> You can merge this Pull Request by running:\n>\n>  git pull https://github.com/jwkoelewijn/grape no_header_set_404\n>\n> Or you can view, comment on it, or merge it online at:\n>\n>  https://github.com/intridea/grape/pull/79\n>\n> -- Commit Summary --\n>\n> * Return 404 if no header is sent, but header based version is used\n>\n> -- File Changes --\n>\n> M lib/grape/middleware/versioner/header.rb (8)\n> M spec/grape/middleware/versioner/header_spec.rb (14)\n>\n> -- Patch Links --\n>\n>  https://github.com/intridea/grape/pull/79.patch\n>  https://github.com/intridea/grape/pull/79.diff\n>\n> ---\n> Reply to this email directly or view it on GitHub:\n> https://github.com/intridea/grape/pull/79\n>\n\n\n\n-- \nP.S. I've been working on a car blog (http://rockyroadblog.com). If you or\nany friends are into cars, I'd love to hear what you guys think.","id":2849941,"url":"https://api.github.com/repos/intridea/grape/issues/comments/2849941"}}