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:
parent
ab281f511c
commit
dc5300adb6
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue