Permalink
Browse files

Unknown :format param should result in empty request.formats

  • Loading branch information...
jeremy committed Nov 8, 2009
1 parent 103b298 commit a595abff211eee97d75c51c085cfdc821b1edb46
Showing with 5 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_dispatch/http/request.rb
  2. +4 −0 actionpack/test/dispatch/request_test.rb
@@ -167,7 +167,7 @@ def formats
@env["action_dispatch.request.formats"] ||=
if parameters[:format]
- [Mime[parameters[:format]]]
+ Array.wrap(Mime[parameters[:format]])
elsif xhr? || (accept && !accept.include?(?,))
accepts
else
@@ -432,6 +432,10 @@ def teardown
request = stub_request
request.expects(:parameters).at_least_once.returns({ :format => :txt })
assert_equal with_set(Mime::TEXT), request.formats
+
+ request = stub_request
+ request.expects(:parameters).at_least_once.returns({ :format => :unknown })
+ assert request.formats.empty?
end
test "negotiate_mime" do

0 comments on commit a595abf

Please sign in to comment.