File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ def HTTP.post_form(url, params)
530
530
# \HTTP session management
531
531
#
532
532
533
- # Returns intger +80+, the default port to use for \HTTP requests:
533
+ # Returns integer +80+, the default port to use for \HTTP requests:
534
534
#
535
535
# Net::HTTP.default_port # => 80
536
536
#
@@ -1048,7 +1048,20 @@ def read_timeout=(sec)
1048
1048
# Sets the write timeout, in seconds, for +self+ to integer +sec+;
1049
1049
# the initial value is 60.
1050
1050
#
1051
- # Argument +sec+ must be a non-negative numeric value.
1051
+ # Argument +sec+ must be a non-negative numeric value:
1052
+ #
1053
+ # _uri = uri.dup
1054
+ # _uri.path = '/posts'
1055
+ # body = 'bar' * 200000
1056
+ # data = <<EOF
1057
+ # {"title": "foo", "body": "#{body}", "userId": "1"}
1058
+ # EOF
1059
+ # headers = {'content-type': 'application/json'}
1060
+ # http = Net::HTTP.new(hostname)
1061
+ # http.post(_uri.path, data, headers)
1062
+ # # => #<Net::HTTPCreated 201 Created readbody=true>
1063
+ # http.write_timeout = 0
1064
+ # http.post(_uri.path, data, headers) # Raises Net::WriteTimeout.
1052
1065
#
1053
1066
def write_timeout = ( sec )
1054
1067
@socket . write_timeout = sec if @socket
You can’t perform that action at this time.
0 commit comments