Skip to content

Commit

Permalink
Add Faraday 2.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tconst committed Jan 20, 2022
1 parent 6c50e0f commit f74d726
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/twilio-ruby/http/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def _request(request)
f.options.params_encoder = Faraday::FlatParamsEncoder
f.request :url_encoded
f.headers = request.headers
f.request(:basic_auth, request.auth[0], request.auth[1])
if Faraday::VERSION =~ /^2/
f.request(:authorization, :basic, request.auth[0], request.auth[1])
else
f.request(:basic_auth, request.auth[0], request.auth[1])
end
f.proxy = "#{@proxy_prot}://#{@proxy_auth}#{@proxy_path}" if @proxy_prot && @proxy_path
f.options.open_timeout = request.timeout || @timeout
f.options.timeout = request.timeout || @timeout
Expand Down
2 changes: 1 addition & 1 deletion twilio-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |spec|

spec.add_dependency('jwt', '>= 1.5', '<= 2.5')
spec.add_dependency('nokogiri', '>= 1.6', '< 2.0')
spec.add_dependency('faraday', '>= 0.9', '< 2.0')
spec.add_dependency('faraday', '>= 0.9', '< 2.2')
# Workaround for RBX <= 2.2.1, should be fixed in next version
spec.add_dependency('rubysl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'

Expand Down

0 comments on commit f74d726

Please sign in to comment.