class Sinatra::Response

def finish

def finish
  result = body
  if drop_content_info?
    headers.delete 'content-length'
    headers.delete 'content-type'
  end
  if drop_body?
    close
    result = []
  end
  if calculate_content_length?
    # if some other code has already set content-length, don't muck with it
    # currently, this would be the static file-handler
    headers['content-length'] = body.map(&:bytesize).reduce(0, :+).to_s
  end
  [status, headers, result]
end