Skip to content
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

Merged
merged 1 commit into from
Mar 29, 2024
Merged

Support faraday 1.0 and 2.0 #124

merged 1 commit into from
Mar 29, 2024

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Mar 29, 2024

support faraday 1.0 and 2.0

manageiq-api-client.gemspec Outdated Show resolved Hide resolved
@@ -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"
Copy link
Member

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)
Copy link
Member

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.

rescue LoadError
# faraday 1.0
begin
require "faraday_middleware"
Copy link
Member

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

@Fryguy Fryguy merged commit a8d6311 into ManageIQ:master Mar 29, 2024
7 checks passed
@Fryguy Fryguy self-assigned this Mar 29, 2024
jrafanie added a commit that referenced this pull request May 13, 2024
- Support faraday 1.0 and 2.0 [[#124]](#124)
- Upgrade faraday from 1.0 to 2.0 [[#122]](#122)
- Revert "drop activesupport dependency" [[#119]](#119)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants