drbrain/net-http-persistent

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

ProGM opened this issue · 2 comments

ProGM commented

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)

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
5d4b76c

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 lostisland/faraday#617

I believe this is fixed by lostisland/faraday#619