Class: Webmachine::Adapters::Rack::RackResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/webmachine/adapters/rack.rb

Constant Summary collapse

ONE_FIVE =
'1.5'.freeze
LOWERCASE_CONTENT_TYPE =

Header names are normalised to lowercase by build_rack_response_headers, so use the lowercase form everywhere inside RackResponse too.

'content-type'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(body, status, headers) ⇒ RackResponse

Returns a new instance of RackResponse.



199
200
201
202
203
# File 'lib/webmachine/adapters/rack.rb', line 199

def initialize(body, status, headers)
  @body = body
  @status = status
  @headers = headers
end

Instance Method Details

#finishObject



205
206
207
208
209
# File 'lib/webmachine/adapters/rack.rb', line 205

def finish
  @headers[LOWERCASE_CONTENT_TYPE] ||= TEXT_HTML if rack_release_enforcing_content_type
  @headers.delete(LOWERCASE_CONTENT_TYPE) if response_without_body
  [@status, @headers, @body]
end