diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-02 12:46:14 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-02 12:46:14 -0600 |
commit | 4dee277a9bc05083de6c831cf9aae0846849ecda (patch) | |
tree | a2e4e2c95bbf7ffd8fd6ace21d95240a4bc6af03 | |
parent | c0949cc8f6c73111075e2c5b41f22f4b99a8ab26 (diff) | |
download | rails-4dee277a9bc05083de6c831cf9aae0846849ecda.tar.gz rails-4dee277a9bc05083de6c831cf9aae0846849ecda.tar.bz2 rails-4dee277a9bc05083de6c831cf9aae0846849ecda.zip |
Stop escaping "[]" in query string
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index f029b634d6..5e9c36bbaf 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -486,9 +486,7 @@ module ActionDispatch }.join("&") when String raise ArgumentError, "value must be a Hash" if prefix.nil? - "#{Rack::Utils.escape(prefix)}=#{Rack::Utils.escape(value)}" - when NilClass - Rack::Utils.escape(prefix) + "#{prefix}=#{Rack::Utils.escape(value)}" else if value.respond_to?(:to_param) build_nested_query(value.to_param.to_s, prefix) diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 84564f4e43..b83c5792ba 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -1621,7 +1621,7 @@ class RouteSetTest < ActiveSupport::TestCase end def test_expand_array_build_query_string - assert_uri_equal '/foo?x%5B%5D=1&x%5B%5D=2', default_route_set.generate({:controller => 'foo', :x => [1, 2]}) + assert_uri_equal '/foo?x[]=1&x[]=2', default_route_set.generate({:controller => 'foo', :x => [1, 2]}) end def test_escape_spaces_build_query_string_selected_keys @@ -2012,9 +2012,9 @@ class RackMountIntegrationTests < ActiveSupport::TestCase assert_equal '/posts', @routes.generate({:controller => 'posts'}, {:controller => 'posts', :action => 'index'}) assert_equal '/posts/create', @routes.generate({:action => 'create'}, {:controller => 'posts'}) assert_equal '/posts?foo=bar', @routes.generate(:controller => 'posts', :foo => 'bar') - assert_equal '/posts?foo%5B%5D=bar&foo%5B%5D=baz', @routes.generate(:controller => 'posts', :foo => ['bar', 'baz']) + assert_equal '/posts?foo[]=bar&foo[]=baz', @routes.generate(:controller => 'posts', :foo => ['bar', 'baz']) assert_equal '/posts?page=2', @routes.generate(:controller => 'posts', :page => 2) - assert_equal '/posts?q%5Bfoo%5D%5Ba%5D=b', @routes.generate(:controller => 'posts', :q => { :foo => { :a => 'b'}}) + assert_equal '/posts?q[foo][a]=b', @routes.generate(:controller => 'posts', :q => { :foo => { :a => 'b'}}) assert_equal '/', @routes.generate(:controller => 'news', :action => 'index') assert_equal '/', @routes.generate(:controller => 'news', :action => 'index', :format => nil) |