Skip to content

Commit

Permalink
Suppress warning: URI.escape is obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Apr 9, 2017
1 parent 65fde67 commit 7d94079
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/yajl/http_stream.rb
Expand Up @@ -4,6 +4,7 @@
require 'yajl'
require 'yajl/version' unless defined? Yajl::VERSION
require 'uri'
require 'cgi'

module Yajl
# This module is for making HTTP requests to which the response bodies (and possibly requests in the near future)
Expand Down Expand Up @@ -101,7 +102,7 @@ def self.request(method, uri, opts = {}, &block)
default_headers["Content-Type"] = opts["Content-Type"] || "application/x-www-form-urlencoded"
body = opts.delete(:body)
if body.is_a?(Hash)
body = body.keys.collect {|param| "#{URI.escape(param.to_s)}=#{URI.escape(body[param].to_s)}"}.join('&')
body = body.keys.collect {|param| "#{CGI.escape(param.to_s)}=#{CGI.escape(body[param].to_s)}"}.join('&')
end
default_headers["Content-Length"] = body.length
end
Expand Down

0 comments on commit 7d94079

Please sign in to comment.