diff options
author | Burdette Lamar <[email protected]> | 2023-02-02 08:03:12 -0600 |
---|---|---|
committer | git <[email protected]> | 2023-02-02 14:03:19 +0000 |
commit | 5a9e2f142d9debfb44d7d23f6821b810607d9d15 () | |
tree | 4496baeb96de654551cc3489e99a3e2b4880c1e6 /lib/net/http/generic_request.rb | |
parent | 89d95478004f50439b2605e2a3a8c447ddbcd539 (diff) |
[ruby/net-http] [DOC] Enhanced RDoc for HTTPGenericRequest
(https://.com/ruby/net-http/pull/113) https://.com/ruby/net-http/commit/14c8405702
-rw-r--r-- | lib/net/http/generic_request.rb | 92 |
1 files changed, 84 insertions, 8 deletions
@@ -1,14 +1,18 @@ # frozen_string_literal: false -# HTTPGenericRequest is the parent of the Net::HTTPRequest class. -# Do not use this directly; use a subclass of Net::HTTPRequest. # -# Mixes in the Net::HTTPHeader module to provide easier access to HTTP headers. # class Net::HTTPGenericRequest include Net::HTTPHeader - def initialize(m, reqbody, resbody, uri_or_path, initheader = nil) @method = m @request_has_body = reqbody @response_has_body = resbody @@ -53,15 +57,47 @@ class Net::HTTPGenericRequest @body_data = nil end attr_reader :method attr_reader :path attr_reader :uri - # Automatically set to false if the user sets the Accept-Encoding header. - # This indicates they wish to handle Content-encoding in responses - # themselves. attr_reader :decode_content def inspect "\#<#{self.class} #{@method}>" end @@ -76,21 +112,45 @@ class Net::HTTPGenericRequest super key, val end def request_body_permitted? @request_has_body end def response_body_permitted? @response_has_body end - def body_exist? warn "Net::HTTPRequest#body_exist? is obsolete; use response_body_permitted?", uplevel: 1 if $VERBOSE response_body_permitted? end attr_reader :body def body=(str) @body = str @body_stream = nil @@ -98,8 +158,24 @@ class Net::HTTPGenericRequest str end attr_reader :body_stream def body_stream=(input) @body = nil @body_stream = input |