lib/chef-api/connection.rb in chef-api-0.10.7 vs lib/chef-api/connection.rb in chef-api-0.10.10
- old
+ new
@@ -1,9 +1,9 @@
-require "net/http"
-require "net/https"
-require "openssl"
-require "uri"
+require "net/http" unless defined?(Net::HTTP)
+require "openssl" unless defined?(OpenSSL)
+require "uri" unless defined?(URI)
+require "cgi" unless defined?(CGI)
module ChefAPI
#
# Connection object for the ChefAPI API.
#
@@ -374,10 +374,10 @@
# @return [String, nil]
# the query string as a string, or +nil+ if there are no params
#
def to_query_string(hash)
hash.map do |key, value|
- "#{URI.escape(key.to_s)}=#{URI.escape(value.to_s)}"
+ "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
end.join("&")[/.+/]
end
private