-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow Faraday v2 usage #1411
Allow Faraday v2 usage #1411
Conversation
octokit was returning 404 not found issue and this issue is been surfacing for a week. I updated faraday in other dependencies of a project. Which did resolve the issue. as i find faraday is being used in octokit. @tisba please review this PR when you have time. Thank you in advance. |
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.
This looks good to me. It's a nice and minimal set to support v1 and v2 at the same time.
Nice work! :)
module Octokit | ||
module Response | ||
# In Faraday 2.x, Faraday::Response::Middleware was removed | ||
BaseMiddleware = defined?(Faraday::Response::Middleware) ? Faraday::Response::Middleware : Faraday::Middleware |
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.
Worth noting that Faraday::Middleware
can be used as far back as v1.2.0: lostisland/faraday@d56742a
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') | ||
begin | ||
require 'faraday/retry' | ||
rescue LoadError | ||
Octokit::Warnable.octokit_warn 'To use retry middleware with Faraday v2.0+, install `faraday-retry` gem' | ||
end | ||
end |
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.
Is faraday-retry
usable on Faraday 1.x? I wonder if it makes sense to just add it as a dependency if so.
Co-authored-by: Bobby McDonald <BobbyMcWho@users.noreply.github.com>
No breaking changes really in the major versions - https://github.com/octokit/octokit.rb/releases/tag/v6.0.0 - https://github.com/octokit/octokit.rb/releases/tag/v5.0.0 The breaking changes happened with the move to Faraday 2: - octokit/octokit.rb#1411 - octokit/octokit.rb#1392 - http://patrik.codes/2022/octokit
No breaking changes really in the major versions - https://github.com/octokit/octokit.rb/releases/tag/v6.0.0 - https://github.com/octokit/octokit.rb/releases/tag/v5.0.0 The breaking changes happened with the move to Faraday 2: - octokit/octokit.rb#1411 - octokit/octokit.rb#1392 - http://patrik.codes/2022/octokit
To support Faraday v2 this PR:
~> 0.16.0
which shouldn't be a big deal since it was a reverted release: v0.17.0 looks to be a bad release lostisland/faraday#1049 (versions< 0.16.0
and~> 0.17.0
are already not supported byoctokit
)sawyer
form~> 0.8.0
to~> 0.9.0
faraday-retry
is present and warns user if gem is not installedThis PR is a successor to #1358