How to use the axios-retry.isNetworkOrIdempotentRequestError function in axios-retry

To help you get started, we’ve selected a few axios-retry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lifeomic / cli / lib / api.js View on Github external
retryCondition: err =>
        (axiosRetry.isNetworkOrIdempotentRequestError(err) ||
          (err.response.status >= 400 && err.response.status < 500))
    }
github vtex / node-vtex-api / src / utils / retry.ts View on Github external
export const isNetworkErrorOrRouterTimeout = (e: any) => {
  if (isNetworkOrIdempotentRequestError(e)) {
    printLabel(e, 'Retry from network error')
    return true
  }

  if (e && isSafeRequestError(e) && e.response && e.response.data && e.response.data.code === TIMEOUT_CODE) {
    printLabel(e, 'Retry from timeout')
    return true
  }

  return false
}

axios-retry

Axios plugin that intercepts failed requests and retries them whenever posible.

Apache-2.0
Latest version published 4 months ago

Package Health Score

82 / 100
Full package analysis