Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Unknown :format param should result in empty request.formats

  • Loading branch information...
commit a595abff211eee97d75c51c085cfdc821b1edb46 1 parent 103b298
@jeremy jeremy authored
View
2  actionpack/lib/action_dispatch/http/request.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
View
4 actionpack/test/dispatch/request_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.