wretch
    Preparing search index...

    Type Alias RetryOptions

    type RetryOptions = {
        delayRamp?: DelayRampFunction;
        delayTimer?: number;
        maxAttempts?: number;
        onRetry?: OnRetryFunction;
        resolveWithLatestResponse?: boolean;
        retryOnNetworkError?: boolean;
        skip?: SkipFunction;
        until?: UntilFunction;
    }
    Index

    Properties

    delayRamp?: DelayRampFunction

    The custom function that is used to calculate the actual delay based on the the timer & the number of attemps.

    Default: delay * nbOfAttemps

    delayTimer?: number

    The timer between each attempt in milliseconds.

    Default: 500

    maxAttempts?: number

    The maximum number of retries before resolving the promise with the last error. Specifying 0 means infinite retries.

    Default: 10

    onRetry?: OnRetryFunction

    Callback that will get executed before retrying the request. If this function returns an object having url and/or options properties, they will override existing values in the retried request.

    The callback receives an object with: response, error, url, attempt (current attempt number, starting at 1), and options.

    Default: undefined

    resolveWithLatestResponse?: boolean

    If true, the request will be resolved with the latest response instead of rejected with an error.

    Default: false

    retryOnNetworkError?: boolean

    If true, will retry the request if a network error was thrown. Will also provide an 'error' argument to the onRetry and until methods.

    Default: false

    If skip returns true, the request will not be retried.

    Example:

    (url, options) => (
    options.method !== "GET"
    )

    Default: undefined

    The request will be retried until that condition is satisfied.

    Default: response && (response.ok || (response.status >= 400 && response.status < 500))