Class: Async::HTTP::Request
- Inherits:
-
Object
- Object
- Async::HTTP::Request
- Includes:
- Body::Reader
- Defined in:
- lib/async/http/request.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#authority ⇒ Object
Returns the value of attribute authority.
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #connect? ⇒ Boolean
- #head? ⇒ Boolean
- #idempotent? ⇒ Boolean
-
#initialize(scheme = nil, authority = nil, method = nil, path = nil, version = nil, headers = [], body = nil) ⇒ Request
constructor
A new instance of Request.
- #inspect ⇒ Object
- #to_s ⇒ Object
Methods included from Body::Reader
#body?, #close, #each, #finish, #read, #save
Constructor Details
#initialize(scheme = nil, authority = nil, method = nil, path = nil, version = nil, headers = [], body = nil) ⇒ Request
Returns a new instance of Request.
30 31 32 33 34 35 36 37 38 |
# File 'lib/async/http/request.rb', line 30 def initialize(scheme = nil, = nil, method = nil, path = nil, version = nil, headers = [], body = nil) @scheme = scheme @authority = @method = method @path = path @version = version @headers = headers @body = body end |
Instance Attribute Details
#authority ⇒ Object
Returns the value of attribute authority.
41 42 43 |
# File 'lib/async/http/request.rb', line 41 def @authority end |
#body ⇒ Object
Returns the value of attribute body.
46 47 48 |
# File 'lib/async/http/request.rb', line 46 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
45 46 47 |
# File 'lib/async/http/request.rb', line 45 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
42 43 44 |
# File 'lib/async/http/request.rb', line 42 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
43 44 45 |
# File 'lib/async/http/request.rb', line 43 def path @path end |
#scheme ⇒ Object
Returns the value of attribute scheme.
40 41 42 |
# File 'lib/async/http/request.rb', line 40 def scheme @scheme end |
#version ⇒ Object
Returns the value of attribute version.
44 45 46 |
# File 'lib/async/http/request.rb', line 44 def version @version end |
Class Method Details
Instance Method Details
#connect? ⇒ Boolean
52 53 54 |
# File 'lib/async/http/request.rb', line 52 def connect? self.method == CONNECT end |
#head? ⇒ Boolean
48 49 50 |
# File 'lib/async/http/request.rb', line 48 def head? self.method == HEAD end |
#idempotent? ⇒ Boolean
62 63 64 |
# File 'lib/async/http/request.rb', line 62 def idempotent? method != POST && (body.nil? || body.empty?) end |
#inspect ⇒ Object
70 71 72 |
# File 'lib/async/http/request.rb', line 70 def inspect "\#<#{self.class} #{self.to_s} scheme=#{@scheme.inspect} authority=#{@authority.inspect} headers=#{@headers.to_h.inspect} body=#{@body.inspect}>" end |
#to_s ⇒ Object
66 67 68 |
# File 'lib/async/http/request.rb', line 66 def to_s "#{@method} #{@path} #{@version}" end |