lostisland/faraday-net_http

undefined method `idle_timeout=' for #<Net::HTTP :80 open=false>

dgutov opened this issue · 2 comments

Just wanted to mention this problem with the example in the README.

Seems like this got carried over from another adapter (net_http_persistent).

To reproduce:

irb(main):042:1* conn = Faraday.new do |f|
irb(main):043:2*   f.adapter :net_http do |http|
irb(main):044:2*     # yields Net::HTTP
irb(main):045:2*     http.idle_timeout = 100
irb(main):046:3*     http.verify_callback = lambda do |preverify, cert_store|
irb(main):047:3*       # do something here...
irb(main):048:2*     end
irb(main):049:1*   end
irb(main):050:0> end
=> 
#<Faraday::Connection:0x0000558447fe7970
...
irb(main):051:0> 
irb(main):052:0> conn.get
Traceback (most recent call last):
...
	 1: from /home/dgutov/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:188:in `configure_request'
(irb):45:in `block (2 levels) in <main>': undefined method `idle_timeout=' for #<Net::HTTP :80 open=false> (NoMethodError)

Ah - that could be a simple copypasta error. Thanks for the report!

It actually is, only verify_callback exists in Net::HTTP, thanks for raising this @dgutov, I'll fix the README