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 empty = b.empty? s = (@status ||= empty ? 404 : default_status) set_default_headers h = @headers if empty && (s == 304 || s == 204 || s == 205 || (s >= 100 && s <= 199)) h.delete("Content-Type") else h["Content-Length"] ||= @length.to_s end [s, h, b] end