diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-12 20:57:09 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-12 20:57:09 +0000 |
commit | 7661c2b50aa5ab6d497d6e41cf53545136c4bd37 (patch) | |
tree | 55d65c748aa174b74933b61b375bef83845140e0 /actionpack/test | |
parent | 74f60c032e92b2473b5feeeb85782836c2b83fdd (diff) | |
download | rails-7661c2b50aa5ab6d497d6e41cf53545136c4bd37.tar.gz rails-7661c2b50aa5ab6d497d6e41cf53545136c4bd37.tar.bz2 rails-7661c2b50aa5ab6d497d6e41cf53545136c4bd37.zip |
Skip params with empty names, such as the &=Save query string from <input type=submit/>. Closes #2569.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5094 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rwxr-xr-x | actionpack/test/controller/cgi_test.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index 4f04a42e84..2d21e0ae97 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -16,7 +16,8 @@ class CGITest < Test::Unit::TestCase @query_string_with_many_equal = "action=create_customer&full_name=abc=def=ghi" @query_string_without_equal = "action" @query_string_with_many_ampersands = - "&action=create_customer&&&full_name=David%20Heinemeier%20Hansson" + "&action=create_customer&&&full_name=David%20Heinemeier%20Hansson" + @query_string_with_empty_key = "action=create_customer&full_name=David%20Heinemeier%20Hansson&=Save" end def test_query_string @@ -99,6 +100,13 @@ class CGITest < Test::Unit::TestCase CGIMethods.parse_query_parameters(@query_string_without_equal) ) end + + def test_query_string_with_empty_key + assert_equal( + { "action" => "create_customer", "full_name" => "David Heinemeier Hansson" }, + CGIMethods.parse_query_parameters(@query_string_with_empty_key) + ) + end def test_query_string_with_many_ampersands assert_equal( @@ -117,7 +125,8 @@ class CGITest < Test::Unit::TestCase "something_nil" => [ nil ], "something_empty" => [ "" ], "products[first]" => [ "Apple Computer" ], - "products[second]" => [ "Pc" ] + "products[second]" => [ "Pc" ], + "" => [ 'Save' ] } expected_output = { |