diff options
| author | azohoori <azohoori@cisco.com> | 2019-02-01 13:49:42 -0700 |
|---|---|---|
| committer | azohoori <azohoori@cisco.com> | 2019-02-01 13:49:42 -0700 |
| commit | 321a5d11a4b03451edfbb3745c7fd5bdb442b349 (patch) | |
| tree | 29f76a8724df8743c6bcfa79ced14ee8b0c868a0 | |
| parent | 483539fb5fd36c8085c25ab3b2287561fd62a373 (diff) | |
adding open timeout attribute
| -rw-r--r-- | lib/net/hippie/client.rb | 2 | ||||
| -rw-r--r-- | test/net/client_test.rb | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index e554562..2343de7 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -12,6 +12,7 @@ module Net attr_accessor :mapper attr_accessor :read_timeout + attr_accessor :open_timeout attr_accessor :logger def initialize( @@ -99,6 +100,7 @@ module Net def http_for(uri) http = Net::HTTP.new(uri.host, uri.port) http.read_timeout = read_timeout + http.open_timeout = open_timeout if open_timeout http.use_ssl = uri.scheme == 'https' http.verify_mode = verify_mode http.set_debug_output(logger) diff --git a/test/net/client_test.rb b/test/net/client_test.rb index e20dffb..53f9b1f 100644 --- a/test/net/client_test.rb +++ b/test/net/client_test.rb @@ -229,4 +229,10 @@ class ClientTest < Minitest::Test end assert(@called) end + + def test_open_timeout_setting + assert_equal subject.open_timeout, nil + @subject.open_timeout = 10 + assert_equal subject.open_timeout, 10 + end end |
