Permalink
Browse files

Don't assume :params is a Hash

  • Loading branch information...
1 parent c9d9bd7 commit 3f632027819ab331187ca58c014458dfcfd57a89 @jeremy jeremy committed Apr 26, 2009
Showing with 1 addition and 4 deletions.
  1. +1 −4 actionpack/lib/action_dispatch/test/mock.rb
@@ -21,10 +21,7 @@ def env_for(path, opts)
if method == "POST" && !opts.has_key?(:input)
opts["CONTENT_TYPE"] = "application/x-www-form-urlencoded"
- multipart = (opts[:params] || {}).any? do |k, v|
- UploadedFile === v
- end
-
+ multipart = opts[:params].respond_to?(:any?) && opts[:params].any? { |k, v| UploadedFile === v }
if multipart
opts[:input] = multipart_body(opts.delete(:params))
opts["CONTENT_LENGTH"] ||= opts[:input].length.to_s

0 comments on commit 3f63202

Please sign in to comment.