waitForOne method

Future<PendingRequest> waitForOne(
  1. String url, {
  2. HttpMethod? method,
  3. Duration timeout = const Duration(seconds: 5),
})

Waits for middleware-delayed requests without sleeps or polling. Matching reserves the request; flush/fail it and verify after awaiting work.

Implementation

Future<PendingRequest> waitForOne(String url,
        {HttpMethod? method,
        Duration timeout = const Duration(seconds: 5)}) =>
    waitForOneWhere(
        (request) =>
            request.uri.toString() == url &&
            (method == null || request.method == method),
        timeout: timeout,
        description: '${method?.value ?? "ANY"} $url');