twilio / twilio-ruby

A Ruby gem for communicating with the Twilio API and generating TwiML
MIT License
1.35k stars 463 forks source link

fix: Allow configuring Faraday adapter with configure_connection block #683

Open doryphores opened 9 months ago

doryphores commented 9 months ago

Fixes

A small change to Twilio::HTTP::Client to allow us to configure the Faraday adapter with configure_connection.

For example:

client = Twilio::REST::Client.new(account_sid, auth_token)

client.http_client.configure_connection do |faraday|
  faraday.adapter :typhoeus, verbose: true
end

Without this change, the above configuration would be ignored because the adapter is reset after the configure connection blocks are applied.

And we cannot pass params to the adapter with the adapter accessor on the client instance:

client = Twilio::REST::Client.new(account_sid, auth_token)

# here, we cannot configure the typhoeus adapter with verbose: true
client.http_client.adapter = :typhoeus

Checklist

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.