Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Slightly less annoying check for acceptable mime_types. This allows A…

…ccept: application/json, application/jsonp (and the like), but still blacklists browsers. Essentially, we use normal content negotiation unless you include */* in your list, in which case we assume you're a browser and send HTML [#3541 state:resolved]
  • Loading branch information...
commit dc5300adb6d46252c26e239ac67e3ca6e5e2d77b 1 parent ab281f5
@paul paul authored wycats committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_dispatch/http/mime_negotiation.rb
View
4 actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -48,7 +48,7 @@ def formats
@env["action_dispatch.request.formats"] ||=
if parameters[:format]
Array(Mime[parameters[:format]])
- elsif xhr? || (accept && !accept.include?(?,))
+ elsif xhr? || (accept && accept !~ /,\s*\*\/\*/)
accepts
else
[Mime::HTML]
@@ -87,4 +87,4 @@ def negotiate_mime(order)
end
end
end
-end
+end

2 comments on commit dc5300a

@dmathieu
Collaborator

Shouldn't there be some tests with it ?

@jeremy
Owner

Yes. Reopened the ticket.

Please sign in to comment.
Something went wrong with that request. Please try again.