mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-20 00:03:11 -04:00
Fixes an incompatibility with new proxy detection and Addressable::URI gem (#722)
fixes #721
This commit is contained in:
parent
ead6e342f6
commit
b09c6db315
@ -374,7 +374,7 @@ module Faraday
|
||||
@temp_proxy = self.proxy
|
||||
|
||||
# Set temporary proxy if request url is absolute
|
||||
@temp_proxy = proxy_from_env(url) if url && URI(url).absolute?
|
||||
@temp_proxy = proxy_from_env(url) if url && Utils.URI(url).absolute?
|
||||
|
||||
request = build_request(method) do |req|
|
||||
req.options = req.options.merge(:proxy => @temp_proxy)
|
||||
@ -448,8 +448,9 @@ module Faraday
|
||||
uri = nil
|
||||
if URI.parse('').respond_to?(:find_proxy)
|
||||
case url
|
||||
when String
|
||||
uri = URI.parse(url).find_proxy
|
||||
when String
|
||||
uri = Utils.URI(url)
|
||||
uri = URI.parse("#{uri.scheme}://#{uri.hostname}").find_proxy
|
||||
when URI
|
||||
uri = url.find_proxy
|
||||
when nil
|
||||
|
@ -231,7 +231,7 @@ class TestConnection < Faraday::TestCase
|
||||
end
|
||||
|
||||
def test_env_url_escapes_per_spec
|
||||
uri = env_url('http:/', 'a' => '1+2 foo~bar.-baz')
|
||||
uri = env_url(nil, 'a' => '1+2 foo~bar.-baz')
|
||||
assert_equal 'a=1%2B2+foo~bar.-baz', uri.query
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user