drbrain / net-http-persistent

Thread-safe persistent connections with Net::HTTP
http://seattlerb.rubyforge.org/net-http-persistent
339 stars 117 forks source link

`net-http-persistent` 3.0 and `faraday` incompatibility #80

Closed ProGM closed 5 years ago

ProGM commented 8 years ago

We are using net-http-persistent with faraday in our neo4j-core gem.

              Faraday.new(url) do |c|
                c.request :basic_auth, user, password
                c.request :multi_json

                c.response :multi_json, symbolize_keys: true, content_type: 'application/json'
                c.use Faraday::Adapter::NetHttpPersistent

                # c.response :logger, ::Logger.new(STDOUT), bodies: true

                c.headers['Content-Type'] = 'application/json'
                c.headers['User-Agent'] = @user_agent_string
              end

https://github.com/neo4jrb/neo4j-core/blob/478595b5c6ee6cda2602aad4080ab4a7ea8f0ce3/lib/neo4j/core/cypher_session/adaptors/http.rb#L141

After upgrading to 3.0.0, it breaks on initialization, with:

/home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/net-http-persistent-3.0.0/lib/net/http/persistent.rb:505:in `initialize': wrong number of arguments (given 2, expected 0) (ArgumentError)
esthervillars commented 8 years ago

I can repro this as well when using net-http-persistent with faraday and after upgrading to 3.0.0 .. adding references below

breaking change in 3.0.0 https://github.com/drbrain/net-http-persistent/commit/5d4b76c22dd38d29b6fbc1ed700a2a1c78c5abc4

https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http_persistent.rb#L21

Interim fix is to use 2.9.x with faraday https://github.com/lostisland/faraday/issues/617

russell commented 5 years ago

I believe this is fixed by https://github.com/lostisland/faraday/pull/619