diff --git a/lib/puppetdb/connection.rb b/lib/puppetdb/connection.rb index 426b265..70f0c9b 100644 --- a/lib/puppetdb/connection.rb +++ b/lib/puppetdb/connection.rb @@ -60,7 +60,7 @@ def query(endpoint, query = nil, options = {}, version = :v4) end uri = "/pdb/query/#{version}/#{endpoint}" - uri += URI.escape "?query=#{query.to_json}" unless query.nil? || query.empty? + uri += "?query=#{URI.encode_www_form_component(query.to_json)}" unless query.nil? || query.empty? debug("PuppetDB query: #{query.to_json}")