diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bafe5fa..c5cbe32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Gemfile b/Gemfile index c9d9afa..5998ba2 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/faraday-net_http_persistent.gemspec b/faraday-net_http_persistent.gemspec index 7e7cb84..d14adae 100644 --- a/faraday-net_http_persistent.gemspec +++ b/faraday-net_http_persistent.gemspec @@ -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" @@ -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 diff --git a/lib/faraday/adapter/net_http_persistent.rb b/lib/faraday/adapter/net_http_persistent.rb index df2969b..3e1b9ad 100644 --- a/lib/faraday/adapter/net_http_persistent.rb +++ b/lib/faraday/adapter/net_http_persistent.rb @@ -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 @@ -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 diff --git a/lib/faraday/net_http_persistent/version.rb b/lib/faraday/net_http_persistent/version.rb index c87ea2c..9a5a0c4 100644 --- a/lib/faraday/net_http_persistent/version.rb +++ b/lib/faraday/net_http_persistent/version.rb @@ -2,6 +2,6 @@ module Faraday module NetHttpPersistent - VERSION = "1.2.0" + VERSION = "2.0.0" end end