diff options
author | Burdette Lamar <[email protected]> | 2023-02-03 08:33:47 -0600 |
---|---|---|
committer | git <[email protected]> | 2023-02-03 14:33:53 +0000 |
commit | faa4c2279aa018a2bb9bc09107adf8a8fcf5fd3d (patch) | |
tree | e964fa509ef727df56c5bc97787ac139b7e5a659 /lib/net | |
parent | 4d35365aceedf575cff9eefbc8830923b4b309d7 (diff) |
[ruby/net-http] [DOC] Enhanced RDoc for write_timeout
(https://github.com/ruby/net-http/pull/115)
https://github.com/ruby/net-http/commit/6da39b0461
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/http.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 2b8e9a9907..231c57e521 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -530,7 +530,7 @@ module Net #:nodoc: # \HTTP session management # - # Returns intger +80+, the default port to use for \HTTP requests: + # Returns integer +80+, the default port to use for \HTTP requests: # # Net::HTTP.default_port # => 80 # @@ -1048,7 +1048,20 @@ module Net #:nodoc: # Sets the write timeout, in seconds, for +self+ to integer +sec+; # the initial value is 60. # - # Argument +sec+ must be a non-negative numeric value. + # Argument +sec+ must be a non-negative numeric value: + # + # _uri = uri.dup + # _uri.path = '/posts' + # body = 'bar' * 200000 + # data = <<EOF + # {"title": "foo", "body": "#{body}", "userId": "1"} + # EOF + # headers = {'content-type': 'application/json'} + # http = Net::HTTP.new(hostname) + # http.post(_uri.path, data, headers) + # # => #<Net::HTTPCreated 201 Created readbody=true> + # http.write_timeout = 0 + # http.post(_uri.path, data, headers) # Raises Net::WriteTimeout. # def write_timeout=(sec) @socket.write_timeout = sec if @socket |