summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorfatkodima <[email protected]>2024-05-14 01:53:16 +0300
committergit <[email protected]>2024-07-11 01:51:03 +0000
commit70bdc0f777f9c2fe7bcee8bbab7b510589c28f93 (patch)
treee0ecf4dba0f1999a9d8f8d3da96be755338b5523 /test/net
parent9f4b45fbf7981a57fd82436ebec8a50ec3d3fdc9 (diff)
[ruby/net-http] Add ability to configure default settings for new connections
https://github.com/ruby/net-http/commit/fed3dcd0c2
Diffstat (limited to 'test/net')
-rw-r--r--test/net/http/test_http.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 9f3bd8b211..a49cc87e8d 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -254,6 +254,18 @@ class TestNetHTTP < Test::Unit::TestCase
end
end
+ def test_default_configuration
+ Net::HTTP.default_configuration = { open_timeout: 5 }
+ http = Net::HTTP.new 'hostname.example'
+ assert_equal 5, http.open_timeout
+ assert_equal 60, http.read_timeout
+
+ http.open_timeout = 10
+ assert_equal 10, http.open_timeout
+ ensure
+ Net::HTTP.default_configuration = nil
+ end
+
end
module TestNetHTTP_version_1_1_methods