Class: Sparrow::ResponseHttpMessage
- Inherits:
-
HttpMessage
- Object
- HttpMessage
- Sparrow::ResponseHttpMessage
- Defined in:
- lib/sparrow/response_http_message.rb
Constant Summary
Constants inherited from HttpMessage
HttpMessage::FORM_HASH_KEY, HttpMessage::RACK_INPUT_KEY
Instance Attribute Summary collapse
-
#body ⇒ Object
The HTTP response body.
-
#headers ⇒ Object
The HTTP header after the middleware was called.
-
#status ⇒ Integer
The HTTP Response Code status.
Attributes inherited from HttpMessage
Instance Method Summary collapse
- #content_type ⇒ Object
- #path ⇒ Object
-
#response ⇒ Object
The wrapped Response instance.
Methods inherited from HttpMessage
#accept, #form_hash?, #initialize, #method_missing, #request
Constructor Details
This class inherits a constructor from Sparrow::HttpMessage
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Sparrow::HttpMessage
Instance Attribute Details
#body ⇒ Object
Returns the HTTP response body.
9 10 11 |
# File 'lib/sparrow/response_http_message.rb', line 9 def body @body end |
#headers ⇒ Object
Returns the HTTP header after the middleware was called.
13 14 15 |
# File 'lib/sparrow/response_http_message.rb', line 13 def headers @headers end |
#status ⇒ Integer
Returns the HTTP Response Code status.
5 6 7 |
# File 'lib/sparrow/response_http_message.rb', line 5 def status @status end |
Instance Method Details
#content_type ⇒ Object
31 32 33 |
# File 'lib/sparrow/response_http_message.rb', line 31 def content_type response.content_type.presence || super end |
#path ⇒ Object
27 28 29 |
# File 'lib/sparrow/response_http_message.rb', line 27 def path super end |
#response ⇒ Object
The wrapped Response instance
18 19 20 21 22 23 24 25 |
# File 'lib/sparrow/response_http_message.rb', line 18 def response clazz = response_class @response ||= if clazz.name == 'ActionDispatch::Response' clazz.new(status, headers_hash, body) else clazz.new(body, status, headers_hash) end end |