mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-04 00:02:03 -04:00
Handle IPv6 address String on Faraday::Connection#proxy_from_env (#1252)
This commit is contained in:
parent
118f896ac3
commit
850155eb41
@ -577,7 +577,7 @@ module Faraday
|
||||
case url
|
||||
when String
|
||||
uri = Utils.URI(url)
|
||||
uri = URI.parse("#{uri.scheme}://#{uri.hostname}").find_proxy
|
||||
uri = URI.parse("#{uri.scheme}://#{uri.host}").find_proxy
|
||||
when URI
|
||||
uri = url.find_proxy
|
||||
when nil
|
||||
|
@ -18,6 +18,13 @@ shared_examples 'initializer with url' do
|
||||
it { expect(subject.path_prefix).to eq('/fish') }
|
||||
it { expect(subject.params).to eq('a' => '1') }
|
||||
end
|
||||
|
||||
context 'with IPv6 address' do
|
||||
let(:address) { 'http://[::1]:85/' }
|
||||
|
||||
it { expect(subject.host).to eq('[::1]') }
|
||||
it { expect(subject.port).to eq(85) }
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'default connection options' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user