Libraries
    Preparing search index...
    • Creates a retry middleware for the @cleverbrush/web client.

      Parameters

      Returns Middleware

      A Middleware that wraps fetch calls with retry logic.

      // Basic usage — retry up to 3 times on server errors:
      const client = createClient(api, {
      middlewares: [retry({ limit: 3 })],
      });

      // Advanced — custom backoff with jitter:
      const client = createClient(api, {
      middlewares: [retry({
      limit: 5,
      delay: (n) => Math.min(1000 * 2 ** n, 30000),
      jitter: true,
      statusCodes: [429, 502, 503],
      })],
      });