Skip to content

Commit

Permalink
Use released Faraday 2.0 and require Ruby 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia committed Jan 4, 2022
1 parent a80a647 commit 2b6fb04
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.6', '2.7', '3.0']
ruby: ['2.6', '2.7', '3.0', '3.1']

steps:
- uses: actions/checkout@v1
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec

gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "simplecov", "~> 0.19.0"
gem "standardrb", "~> 1.0"

gem "multipart-parser", "~> 0.1.1"
gem "webmock", "~> 3.4"
6 changes: 3 additions & 3 deletions faraday-net_http_persistent.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/lostisland/faraday-net_http_persistent"
spec.license = "MIT"

spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/lostisland/faraday-net_http_persistent"
Expand All @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
spec.files = Dir.glob("lib/**/*") + %w[README.md LICENSE.md]
spec.require_paths = ["lib"]

spec.add_dependency "faraday", ">= 2.0.0.alpha.pre.2"
spec.add_dependency "faraday-net_http"
spec.add_dependency "faraday", "~> 2.0"
spec.add_dependency "faraday-net_http", "~> 2.0"
spec.add_dependency "net-http-persistent", "~> 4.0"
end
12 changes: 3 additions & 9 deletions lib/faraday/adapter/net_http_persistent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ def net_http_connection(env)
if Net::HTTP::Persistent.instance_method(:initialize)
.parameters.first == %i[key name]
options = {name: "Faraday"}
if @connection_options.key?(:pool_size)
options[:pool_size] = @connection_options[:pool_size]
end
options[:pool_size] = @connection_options[:pool_size] if @connection_options.key?(:pool_size)
Net::HTTP::Persistent.new(**options)
else
Net::HTTP::Persistent.new("Faraday")
end

proxy_uri = proxy_uri(env)
if @cached_connection.proxy_uri != proxy_uri
@cached_connection.proxy = proxy_uri
end
@cached_connection.proxy = proxy_uri if @cached_connection.proxy_uri != proxy_uri
@cached_connection
end

Expand Down Expand Up @@ -76,9 +72,7 @@ def perform_request(http, env)
rescue Net::HTTP::Persistent::Error => e
raise Faraday::TimeoutError, e if e.message.include? "Timeout"

if e.message.include? "connection refused"
raise Faraday::ConnectionFailed, e
end
raise Faraday::ConnectionFailed, e if e.message.include? "connection refused"

raise
end
Expand Down
2 changes: 1 addition & 1 deletion lib/faraday/net_http_persistent/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Faraday
module NetHttpPersistent
VERSION = "1.2.0"
VERSION = "2.0.0"
end
end

0 comments on commit 2b6fb04

Please sign in to comment.