wretch
    Preparing search index...

    Type Alias RetryMiddleware

    RetryMiddleware: (options?: RetryOptions) => ConfiguredMiddleware

    💡 By default, the request will be retried only for server errors (5xx) and other non-successful responses, but not for client errors (4xx).

    // To retry on all non-2xx responses (including 4xx):
    until: (response, error) => response && response.ok
    import wretch from 'wretch'
    import { retry } from 'wretch/middlewares'

    wretch().middlewares([
    retry({
    // Options - defaults below
    delayTimer: 500,
    delayRamp: (delay, nbOfAttempts) => delay * nbOfAttempts,
    maxAttempts: 10,
    until: (response, error) => response && (response.ok || (response.status >= 400 && response.status < 500)),
    onRetry: null,
    retryOnNetworkError: false,
    resolveWithLatestResponse: false,
    skip: undefined
    })
    ])

    // You can also return a Promise, which is useful if you want to inspect the body:
    wretch().middlewares([
    retry({
    until: response =>
    response.clone().json().then(body =>
    body.field === 'something'
    )
    })
    ])

    Type Declaration