lib/auth0/mixins/httpproxy.rb in auth0-4.16.0 vs lib/auth0/mixins/httpproxy.rb in auth0-4.17.0
- old
+ new
@@ -1,15 +1,17 @@
+require "addressable/uri"
+
module Auth0
module Mixins
# here's the proxy for Rest calls based on rest-client, we're building all request on that gem
# for now, if you want to feel free to use your own http client
module HTTPProxy
attr_accessor :headers, :base_uri, :timeout
# proxying requests from instance methods to HTTP class methods
%i(get post post_file put patch delete delete_with_body).each do |method|
define_method(method) do |path, body = {}, extra_headers = {}|
- safe_path = URI.escape(path)
+ safe_path = Addressable::URI.escape(path)
body = body.delete_if { |_, v| v.nil? }
result = if method == :get
# Mutate the headers property to add parameters.
add_headers({params: body})
# Merge custom headers into existing ones for this req.