Skip to main content
Skip to main content

RetryConfig

swaps.internal.RetryConfig

Configuration for the Axios request method.

Properties

backoffType"linear" | "static" | "exponential"
Backoff Type; 'linear', 'static' or 'exponential'.
checkRetryAfterboolean
Whether to check for 'Retry-After' header in response and use value as delay. Defaults to true.
currentRetryAttemptnumber
The number of retries already attempted.
httpMethodsToRetrystring[]
The HTTP Methods that will be automatically retried. Defaults to ['GET','PUT','HEAD','OPTIONS','DELETE']
The instance of the axios object to which the interceptor is attached.
maxRetryAfternumber
Max permitted Retry-After value (in ms) - rejects if greater. Defaults to 5 mins.
maxRetryDelaynumber
Ceiling for calculated delay (in ms) - delay will not exceed this value.
noResponseRetriesnumber
When there is no response, the number of retries to attempt. Defaults to 2.
onRetryAttempt(err: AxiosError<any, any>) => void
Function to invoke when a retry attempt is made.
retrynumber
The number of times to retry the request. Defaults to 3.
retryDelaynumber
The amount of time to initially delay the retry. Defaults to 100.
shouldRetry(err: AxiosError<any, any>) => boolean
Function to invoke which determines if you should retry
statusCodesToRetrynumber[][]
The HTTP response status codes that will automatically be retried. Defaults to: [[100, 199], [429, 429], [500, 599]]
Was this section helpful?