-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Faraday 2.0 support #591
Conversation
f74d726
to
bbde632
Compare
Hi, @JenniferMah. I noticed that you approved some pull requests in this repository recently. Do you think we can move this one forward? It would be helpful to get rid of the deprecation warnings when using twilio-ruby with faraday 1.x. |
i use twilio in a rails app and this compatibility issue is blocking my upgrade to rails 7- would be great to get this fix out :) |
Hi. Could I help to move this forward? The following is a test for context 'with different Faraday versions' do
let(:connection) { Faraday.new }
before do
allow(Faraday).to receive(:new).and_return(connection).and_yield(connection)
allow(connection).to receive(:request)
allow(connection).to receive(:send).and_return(double('response', status: 301, body: {}, headers: {}))
end
it 'should set basic authorization with Faraday 1.x' do
stub_const('Faraday::VERSION', '1.5')
issue_request_with_auth('a', 'b')
expect(connection).to have_received(:request).with(:basic_auth, 'a', 'b')
expect(connection).not_to have_received(:request).with(:authorization, :basic, 'a', 'b')
end
it 'should set basic authorization with Faraday 2.x' do
stub_const('Faraday::VERSION', '2.2')
issue_request_with_auth('a', 'b')
expect(connection).to have_received(:request).with(:authorization, :basic, 'a', 'b')
expect(connection).not_to have_received(:request).with(:basic_auth, 'a', 'b')
end
def issue_request_with_auth(username, pwd)
@client.request('host', 'port', 'GET', 'url', {}, {}, {}, [username, pwd], nil)
end
end If helpful, let me know if you prefer this in patch form, or as a pull request to this branch. |
It looks like rubocop is flagging the method length with this change, is there any preference on how you all would like me to resolve? |
Those methods flagged by Rubocop weren't changed in this PR, so perhaps that should be dealt with separately? Otherwise it risks widening the scope of this change. I agree that those argument lists are a bit unwieldy at the moment. |
Any updates on getting this PR completed and released? Even a stab at timing would be appreciated - this is the last gem my applications need an update to support Rails 7. |
@tconst the current rubocop complaint is definitely related to the method being changed. Since it's a method length complaint, you could just add disabling pragma comments around that method definition: # rubocop:disable Metrics/MethodLength
def _request(request)
# ...
end
# rubocop:enable Metrics/MethodLength |
@BrianHawley Yea I was hoping to get a response from the maintainers on this, I can either disable the cop or move the conditional out into another method. I'll go ahead and disable for now. |
Hey @JenniferMah, could you or anyone please merge this PR? I'm working on rails 7 app and this faraday thing it's totally blocking my work |
We are also waiting on the same and it is blocking our upgrade to Faraday 2.0 and Rails 7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds support for Faraday 2.x while maintaining backwards compatibility with older versions.
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.