mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
do not assume that there is no space between
leading */* and comma Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
f5fba917f8
commit
eb6ccc9953
2 changed files with 5 additions and 1 deletions
|
@ -48,7 +48,7 @@ module ActionDispatch
|
|||
@env["action_dispatch.request.formats"] ||=
|
||||
if parameters[:format]
|
||||
Array(Mime[parameters[:format]])
|
||||
elsif xhr? || (accept && accept !~ /,\s*\*\/\*|\*\/\*,/)
|
||||
elsif xhr? || (accept && accept !~ /,\s*\*\/\*|\*\/\*\s*,/)
|
||||
accepts
|
||||
else
|
||||
[Mime::HTML]
|
||||
|
|
|
@ -254,6 +254,10 @@ class RespondToControllerTest < ActionController::TestCase
|
|||
@request.accept = "*/*, application/json"
|
||||
get :json_xml_or_html
|
||||
assert_equal 'HTML', @response.body
|
||||
|
||||
@request.accept = "*/* , application/json"
|
||||
get :json_xml_or_html
|
||||
assert_equal 'HTML', @response.body
|
||||
end
|
||||
|
||||
def test_json_or_yaml
|
||||
|
|
Loading…
Reference in a new issue