mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Slightly less annoying check for acceptable mime_types. This allows Accept: 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]
This commit is contained in:
@@ -48,7 +48,7 @@ module ActionDispatch
|
||||
@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 @@ module ActionDispatch
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user