mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Hashes sent via multipart post should be converted to strings #1032 [me@julik.nl]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1664 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
cf9c991d4c
commit
fcdcd9b9fa
3 changed files with 9 additions and 2 deletions
|
@ -125,7 +125,7 @@
|
|||
|
||||
* Add assertions with friendly messages to TestCase#process to ensure that @controller, @request, and @response are set. #1367
|
||||
|
||||
* Arrays sent via multipart posts are converted to strings #1032 [dj@omelia.org]
|
||||
* Arrays, hashes sent via multipart posts are converted to strings #1032 [dj@omelia.org, me@julik.nl]
|
||||
|
||||
* render(:layout => true) is a synonym for render(:layout => nil)
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class CGIMethods #:nodoc:
|
|||
# Value as part of a multipart request
|
||||
value.read
|
||||
elsif value.class == Array
|
||||
value.collect { | e | e.respond_to?(:read) ? e.read : e }
|
||||
value.collect { |v| CGIMethods.get_typed_value(v) }
|
||||
else
|
||||
# Standard value (not a multipart request)
|
||||
value.to_s
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
$:.unshift File.dirname(__FILE__) + "/../../lib"
|
||||
|
||||
require 'test/unit'
|
||||
require 'action_controller/cgi_ext/cgi_methods'
|
||||
|
@ -112,6 +113,7 @@ class CGITest < Test::Unit::TestCase
|
|||
"something" => [ StringIO.new("") ],
|
||||
"array_of_stringios" => [[ StringIO.new("One"), StringIO.new("Two") ]],
|
||||
"mixed_types_array" => [[ StringIO.new("Three"), "NotStringIO" ]],
|
||||
"mixed_types_as_checkboxes[strings][nested]" => [[ mock_file, "String", StringIO.new("StringIO")]],
|
||||
"products[string]" => [ StringIO.new("Apple Computer") ],
|
||||
"products[file]" => [ mock_file ]
|
||||
}
|
||||
|
@ -120,6 +122,11 @@ class CGITest < Test::Unit::TestCase
|
|||
"something" => "",
|
||||
"array_of_stringios" => ["One", "Two"],
|
||||
"mixed_types_array" => [ "Three", "NotStringIO" ],
|
||||
"mixed_types_as_checkboxes" => {
|
||||
"strings"=> {
|
||||
"nested"=>[ mock_file, "String", "StringIO" ]
|
||||
},
|
||||
},
|
||||
"products" => {
|
||||
"string" => "Apple Computer",
|
||||
"file" => mock_file
|
||||
|
|
Loading…
Reference in a new issue