1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05: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:
Paul Sadauskas 2010-02-08 11:08:31 -07:00 committed by wycats
parent ab281f511c
commit dc5300adb6

View file

@ -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