qfetch
    Preparing search index...

    Function withRetryStatus

    • Middleware that retries requests based on response status codes.

      Parameters

      Returns MiddlewareExecutor

      Handles client-controlled retry timing for transient failures. When a response has a retryable status code (by default 408, 429, 500, 502, 503, 504), the middleware waits according to the backoff strategy before retrying.

      Unlike withRetryAfter, this middleware does not parse Retry-After headers. Use this for general retry logic; use withRetryAfter when server timing matters.

      If the request's AbortSignal is aborted during retry delay.

      If the strategy delay exceeds maximum safe timeout (~24.8 days).

      import { withRetryStatus } from "@qfetch/middleware-retry-status";
      import { fullJitter, upto } from "@proventuslabs/retry-strategies";

      const qfetch = withRetryStatus({
      strategy: () => upto(3, fullJitter(100, 10_000))
      })(fetch);