Compare commits

...

2 Commits

Author SHA1 Message Date
Matt
f6c38689c6
Version bump to 2.7.4 2023-01-20 14:54:04 +00:00
Matt
2b9a6241c6
Use Uri.parse instead of Utils.URI (#1485)
Utils.URI can be configured to use a different parser and return an object that "behaves like a URI". However, `opaque` is not available in other objects (e.g. Addressable::URI), so in this instance we need to use URI.

Fixes #1484
2023-01-20 14:53:38 +00:00
3 changed files with 17 additions and 2 deletions

View File

@ -473,7 +473,7 @@ module Faraday
if url && !base.path.end_with?('/')
base.path = "#{base.path}/" # ensure trailing slash
end
url = url.to_s.gsub(':', '%3A') if Utils.URI(url.to_s).opaque
url = url.to_s.gsub(':', '%3A') if URI.parse(url.to_s).opaque
uri = url ? base + url : base
if params
uri.query = params.to_query(params_encoder || options.params_encoder)

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true
module Faraday
VERSION = '2.7.3'
VERSION = '2.7.4'
end

View File

@ -310,6 +310,21 @@ RSpec.describe Faraday::Connection do
expect(uri.to_s).to eq('http://service.com/api/service%3Asearch?limit=400')
end
end
context 'with a custom `default_uri_parser`' do
let(:url) { 'http://httpbingo.org' }
let(:parser) { Addressable::URI }
around do |example|
with_default_uri_parser(parser) do
example.run
end
end
it 'does not raise error' do
expect { conn.build_exclusive_url('/nigiri') }.not_to raise_error
end
end
end
describe '#build_url' do