aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-11-22 08:58:01 -0500
committerJosé Valim <jose.valim@gmail.com>2010-11-22 23:06:12 +0100
commiteb6ccc9953a5e952737174995b5230f0b2c56b1f (patch)
tree94c49b3e4d5647ad249b1407b527e33e72aa37e9 /actionpack
parentf5fba917f8dbf45fcbf04b4b26cf54eb3b300057 (diff)
downloadrails-eb6ccc9953a5e952737174995b5230f0b2c56b1f.tar.gz
rails-eb6ccc9953a5e952737174995b5230f0b2c56b1f.tar.bz2
rails-eb6ccc9953a5e952737174995b5230f0b2c56b1f.zip
do not assume that there is no space between
leading */* and comma Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/http/mime_negotiation.rb2
-rw-r--r--actionpack/test/controller/mime_responds_test.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb
index afce4d9651..2b401114f0 100644
--- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb
+++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -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]
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index 2de9b28e68..7a799411db 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -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