2 parents 49086d1 + 5db97a7 commit be7166cCopy full SHA for be7166c
2 files changed
lib/httparty/request.rb
@@ -174,6 +174,7 @@ def query_string(uri)
174
query_string_parts << options[:query] unless options[:query].nil?
175
end
176
177
+ query_string_parts.reject!(&:empty?) unless query_string_parts == [""]
178
query_string_parts.size > 0 ? query_string_parts.join('&') : nil
179
180
spec/httparty/request_spec.rb
@@ -133,6 +133,12 @@
133
URI.unescape(@request.uri.query).should == ""
134
135
136
+ it "does not append an ampersand when queries are embedded in paths" do
137
+ @request.path = "/path?a=1"
138
+ @request.options[:query] = {}
139
+ @request.uri.query.should == "a=1"
140
+ end
141
+
142
it "does not duplicate query string parameters when uri is called twice" do
143
@request.options[:query] = {:foo => :bar}
144
@request.uri
0 commit comments