Skip to content
This repository
Browse code

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 Sadauskas paul authored wycats committed

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 actionpack/lib/action_dispatch/http/mime_negotiation.rb
4 actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -48,7 +48,7 @@ def formats
48 48 @env["action_dispatch.request.formats"] ||=
49 49 if parameters[:format]
50 50 Array(Mime[parameters[:format]])
51   - elsif xhr? || (accept && !accept.include?(?,))
  51 + elsif xhr? || (accept && accept !~ /,\s*\*\/\*/)
52 52 accepts
53 53 else
54 54 [Mime::HTML]
@@ -87,4 +87,4 @@ def negotiate_mime(order)
87 87 end
88 88 end
89 89 end
90   -end
  90 +end

2 comments on commit dc5300a

Damien Mathieu
Collaborator

Shouldn't there be some tests with it ?

Jeremy Kemper
Owner

Yes. Reopened the ticket.

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