-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support faraday 1.0 and 2.0 #124
Conversation
@@ -24,8 +24,14 @@ Gem::Specification.new do |spec| | |||
spec.require_paths = ["lib"] | |||
|
|||
spec.add_dependency "activesupport", ">= 6.0", "<7.1" | |||
spec.add_dependency "faraday", "~> 2.9" | |||
spec.add_dependency "faraday-follow_redirects" |
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.
faraday-follow-redirects is written in a way that supports both v1 and v2, so we can just add the dependency directly.
@@ -77,10 +77,23 @@ def handle | |||
faraday.options.timeout = @connection_options[:timeout] if @connection_options[:timeout] | |||
faraday.response(:logger, client.logger) | |||
faraday.response(:follow_redirects, :limit => 3, :standards_compliant => true) | |||
if defined?(FaradayMiddleware::FollowRedirects) | |||
# faraday 1.0 | |||
faraday.use(FaradayMiddleware::FollowRedirects, :limit => 3, :standards_compliant => true) |
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 this line needed? Line 79 should take care of it.
lib/manageiq/api/client.rb
Outdated
rescue LoadError | ||
# faraday 1.0 | ||
begin | ||
require "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.
What was previously needed from faraday_middleware? If it was just follow_redirects, I thikn we can just use follow_redirects directly because it supports both v1 and v2
support faraday 1.0 and 2.0