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("Content-Type")
    elsif s == 205
      h.delete("Content-Type")
      h["Content-Length"] = '0'
    else
      h["Content-Length"] ||= '0'
    end
  else
    s = @status || default_status
    h["Content-Length"] ||= @length.to_s
  end
  [s, h, b]
end