class Bullet::Rack

def call(env)

def call(env)
  return @app.call(env) unless Bullet.enable?
  Bullet.start_request
  status, headers, response = @app.call(env)
  return [status, headers, response] if file?(headers) || sse?(response) || empty?(response)
  response_body = nil
  if Bullet.notification?
    if status == 200 && !response_body(response).frozen? && html_request?(headers, response)
      response_body = response_body(response) << Bullet.gather_inline_notifications
      add_footer_note(response_body) if Bullet.add_footer
      headers['Content-Length'] = response_body.bytesize.to_s
    end
  end
  [status, headers, response_body ? [response_body] : response]
ensure
  if Bullet.enable? && Bullet.notification?
    Bullet.perform_out_of_channel_notifications(env)
  end
  Bullet.end_request
end