lib/http/client.rb in http-0.8.12 vs lib/http/client.rb in http-0.8.13
- old
+ new
@@ -1,10 +1,7 @@
require "forwardable"
-require "cgi"
-require "uri"
-
require "http/form_data"
require "http/options"
require "http/headers"
require "http/connection"
require "http/redirector"
@@ -113,21 +110,20 @@
# Merges query params if needed
#
# @param [#to_s] uri
# @return [URI]
- def make_request_uri(uri, options)
+ def make_request_uri(uri, opts)
uri = uri.to_s
if default_options.persistent? && uri !~ HTTP_OR_HTTPS_RE
uri = "#{default_options.persistent}#{uri}"
end
uri = HTTP::URI.parse uri
- if options.params && !options.params.empty?
- params = CGI.parse(uri.query.to_s).merge(options.params || {})
- uri.query = ::URI.encode_www_form params
+ if opts.params && !opts.params.empty?
+ uri.query = [uri.query, HTTP::URI.form_encode(opts.params)].compact.join("&")
end
# Some proxies (seen on WEBRick) fail if URL has
# empty path (e.g. `http://example.com`) while it's RFC-complaint:
# http://tools.ietf.org/html/rfc1738#section-3.1