class Capybara::Server::Middleware
def call(env)
def call(env) if env["PATH_INFO"] == "/__identify__" [200, {}, [@app.object_id.to_s]] else @counter.increment begin @app.call(env) rescue *@server_errors => e @error ||= e raise e ensure @counter.decrement end end end
def initialize(app, server_errors)
def initialize(app, server_errors) @app = app @counter = Counter.new @server_errors = server_errors end
def pending_requests?
def pending_requests? @counter.value > 0 end