class Rack::Events

def call(env)

def call(env)
  request = make_request env
  on_start request, nil
  begin
    status, headers, body = @app.call request.env
    response = make_response status, headers, body
    on_commit request, response
  rescue StandardError => e
    on_error request, response, e
    on_finish request, response
    raise
  end
  body = EventedBodyProxy.new(body, request, response, @handlers) do
    on_finish request, response
  end
  [response.status, response.headers, body]
end