HTTPGenericRequest is the parent of the Net::HTTPRequest
class.
Do not use this directly; instead, use a subclass of Net::HTTPRequest
.
About the Examples
Attributes
[R] | body | Returns the string body for the request, or
|
[R] | body_stream | Returns the body stream object for the request, or
|
[R] | decode_content | Returns
|
[R] | method | Returns the string method name for the request:
|
[R] | path | Returns the string path for the request:
|
[R] | uri | Returns the
|
Instance Public methods
body=(str) Link
Sets the body for the request:
req = Net::HTTP::Post.new(uri)
req.body # => nil
req.body = '{"title": "foo","body": "bar","userId": 1}'
req.body # => "{\"title\": \"foo\",\"body\": \"bar\",\"userId\": 1}"
body_stream=(input) Link
Sets the body stream for the request:
req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST>
req.body_stream # => nil
require 'stringio'
req.body_stream = StringIO.new('xyzzy') # => #<StringIO:0x0000027d1e5affa8>
req.body_stream # => #<StringIO:0x0000027d1e5affa8>
inspect() Link
Returns a string representation of the request:
Net::HTTP::Post.new(uri).inspect # => "#<Net::HTTP::Post POST>"
request_body_permitted?() Link
Returns whether the request may have a body:
Net::HTTP::Post.new(uri).request_body_permitted? # => true
Net::HTTP::Get.new(uri).request_body_permitted? # => false
response_body_permitted?() Link
Returns whether the response may have a body:
Net::HTTP::Post.new(uri).response_body_permitted? # => true
Net::HTTP::Head.new(uri).response_body_permitted? # => false