diff --git a/lib/httparty/request.rb b/lib/httparty/request.rb index 5f2774eb..33e280af 100644 --- a/lib/httparty/request.rb +++ b/lib/httparty/request.rb @@ -53,7 +53,7 @@ def request_uri(uri) end def uri - new_uri = path.relative? ? URI.parse("#{base_uri}#{path}") : path + new_uri = path.relative? ? URI.parse("#{base_uri}#{path}") : path.clone # avoid double query string on redirects [#12] unless redirect diff --git a/spec/httparty/request_spec.rb b/spec/httparty/request_spec.rb index 80078fea..02b0a8af 100644 --- a/spec/httparty/request_spec.rb +++ b/spec/httparty/request_spec.rb @@ -133,6 +133,12 @@ URI.unescape(@request.uri.query).should == "" end + it "does not duplicate query string parameters when uri is called twice" do + @request.options[:query] = {:foo => :bar} + @request.uri + @request.uri.query.should == "foo=bar" + end + context "when representing an array" do it "returns a Rails style query string" do @request.options[:query] = {:foo => %w(bar baz)}