Created
September 20, 2010 07:13
-
-
Save eugenebolshakov/587525 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 6bd56bfb117d9264b78b9a628a7f269674510219 Mon Sep 17 00:00:00 2001 | |
From: eugenebolshakov <eugene.bolshakov@gmail.com> | |
Date: Mon, 20 Sep 2010 10:54:28 +0400 | |
Subject: [PATCH] Use parse_nested_query for parsing URI as that's what Rack does | |
--- | |
lib/rack/test.rb | 2 +- | |
spec/rack/test_spec.rb | 5 +++++ | |
2 files changed, 6 insertions(+), 1 deletions(-) | |
diff --git a/lib/rack/test.rb b/lib/rack/test.rb | |
index 0704370..4d0b667 100644 | |
--- a/lib/rack/test.rb | |
+++ b/lib/rack/test.rb | |
@@ -175,7 +175,7 @@ module Rack | |
if env["REQUEST_METHOD"] == "GET" | |
params = env[:params] || {} | |
params = parse_nested_query(params) if params.is_a?(String) | |
- params.update(parse_query(uri.query)) | |
+ params.update(parse_nested_query(uri.query)) | |
uri.query = build_nested_query(params) | |
elsif !env.has_key?(:input) | |
env["CONTENT_TYPE"] ||= "application/x-www-form-urlencoded" | |
diff --git a/spec/rack/test_spec.rb b/spec/rack/test_spec.rb | |
index 2e38d81..5fee874 100644 | |
--- a/spec/rack/test_spec.rb | |
+++ b/spec/rack/test_spec.rb | |
@@ -91,6 +91,11 @@ describe Rack::Test::Session do | |
last_request.GET.should == { "baz" => "2", "foo" => { "bar" => "1" }} | |
end | |
+ it "comlies with Rack when building query strings for GET requests" do | |
+ request "/foo?bar=2&bar=3" | |
+ last_request.GET.should == Rack::Utils.parse_nested_query('bar=2&bar=3') | |
+ end | |
+ | |
it "accepts raw input in params for GET requests" do | |
request "/foo?baz=2", :params => "foo[bar]=1" | |
last_request.GET.should == { "baz" => "2", "foo" => { "bar" => "1" }} | |
-- | |
1.6.3.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment