class Sparrow::ResponseHttpMessage
Attributes
body[RW]
@return the HTTP response body
headers[RW]
@return the HTTP header after the middleware was called
status[RW]
@return [Integer] the HTTP Response Code status
Public Instance Methods
content_type()
click to toggle source
Calls superclass method
Sparrow::HttpMessage#content_type
# File lib/sparrow/response_http_message.rb, line 31 def content_type response.content_type.presence || super end
path()
click to toggle source
Calls superclass method
Sparrow::HttpMessage#path
# File lib/sparrow/response_http_message.rb, line 27 def path super end
response()
click to toggle source
The wrapped Response instance @return [Object] the response
# 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
Private Instance Methods
headers_hash()
click to toggle source
# File lib/sparrow/response_http_message.rb, line 45 def headers_hash @headers_hash ||= env.merge(headers) end
response_class()
click to toggle source
# File lib/sparrow/response_http_message.rb, line 37 def response_class if defined?(Rails) ActionDispatch::Response else ::Rack::Response end end