Skip to content

Commit

Permalink
Don't assume :params is a Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Apr 26, 2009
1 parent c9d9bd7 commit 3f63202
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions actionpack/lib/action_dispatch/test/mock.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3f63202

Please sign in to comment.