Class: Async::HTTP::Response
- Inherits:
-
Object
- Object
- Async::HTTP::Response
- Includes:
- Body::Buffered::Reader
- Defined in:
- lib/async/http/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#status ⇒ Object
Returns the value of attribute status.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #bad_request? ⇒ Boolean
- #continue? ⇒ Boolean
- #failure? ⇒ Boolean
-
#initialize(version = nil, status = 200, reason = nil, headers = [], body = nil) ⇒ Response
constructor
A new instance of Response.
- #preserve_method? ⇒ Boolean
- #redirection? ⇒ Boolean
- #success? ⇒ Boolean
- #to_s ⇒ Object
Methods included from Body::Buffered::Reader
Constructor Details
#initialize(version = nil, status = 200, reason = nil, headers = [], body = nil) ⇒ Response
Returns a new instance of Response.
28 29 30 31 32 33 34 |
# File 'lib/async/http/response.rb', line 28 def initialize(version = nil, status = 200, reason = nil, headers = [], body = nil) @version = version @status = status @reason = reason @headers = headers @body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
40 41 42 |
# File 'lib/async/http/response.rb', line 40 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
39 40 41 |
# File 'lib/async/http/response.rb', line 39 def headers @headers end |
#reason ⇒ Object
Returns the value of attribute reason.
38 39 40 |
# File 'lib/async/http/response.rb', line 38 def reason @reason end |
#status ⇒ Object
Returns the value of attribute status.
37 38 39 |
# File 'lib/async/http/response.rb', line 37 def status @status end |
#version ⇒ Object
Returns the value of attribute version.
36 37 38 |
# File 'lib/async/http/response.rb', line 36 def version @version end |
Class Method Details
Instance Method Details
#bad_request? ⇒ Boolean
62 63 64 |
# File 'lib/async/http/response.rb', line 62 def bad_request? status == 400 end |
#continue? ⇒ Boolean
42 43 44 |
# File 'lib/async/http/response.rb', line 42 def continue? status == 100 end |
#failure? ⇒ Boolean
58 59 60 |
# File 'lib/async/http/response.rb', line 58 def failure? status >= 400 && status < 600 end |
#preserve_method? ⇒ Boolean
54 55 56 |
# File 'lib/async/http/response.rb', line 54 def preserve_method? status == 307 || status == 308 end |
#redirection? ⇒ Boolean
50 51 52 |
# File 'lib/async/http/response.rb', line 50 def redirection? status >= 300 && status < 400 end |
#success? ⇒ Boolean
46 47 48 |
# File 'lib/async/http/response.rb', line 46 def success? status >= 200 && status < 300 end |
#to_s ⇒ Object
76 77 78 |
# File 'lib/async/http/response.rb', line 76 def to_s "#{@status} #{@reason} #{@version}" end |