module Roda::RodaPlugins::Base::ResponseMethods
def finish
# {'Content-Type'=>'text/html', 'Content-Length'=>'0'},
# => [200,
response.finish
Example:
Adds the Content-Length header to the size of the response body.
been written to, otherwise uses a 404 status.
uses the return value of default_status if the body has
for the current response. If the status has not been set,
Return the rack response array of status, headers, and body
def finish b = @body set_default_headers h = @headers if b.empty? s = @status || 404 if (s == 304 || s == 204 || (s >= 100 && s <= 199)) h.delete(RodaResponseHeaders::CONTENT_TYPE) elsif s == 205 empty_205_headers(h) else h[RodaResponseHeaders::CONTENT_LENGTH] ||= '0' end else s = @status || default_status h[RodaResponseHeaders::CONTENT_LENGTH] ||= @length.to_s end [s, h, b] end