onRequest method

void onRequest(
  1. String operationId, {
  2. required int status,
  3. required String code,
  4. String? reason,
  5. Duration? retryAfter,
  6. int times = 1,
})

Answers the next times requests of operationId with status and a problem with code and reason (409, 410, 412, 429, 5xx), with Retry-After when retryAfter is set.

Implementation

void onRequest(
  String operationId, {
  required int status,
  required String code,
  String? reason,
  Duration? retryAfter,
  int times = 1,
}) => _rules.add(
  _Rule(
    AnswerFault(operationId, status, code, retryAfter, reason: reason),
    times,
  ),
);