New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

axios-retry-tiny

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-retry-tiny

a tiny interceptor for axios to retry request

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

axios-retry-tiny

CircleCI npm-veriosn npm-dt

A tiny interceptor for axios to retry request

Install

npm i axios-retry-tiny --save
# or use yarn
yarn add axios-retry-tiny

Use

const axios = require('axios');
const artiny = require('axios-retry-tiny');
artiny(axios);

(async () => {
  try {
    await axios({
      url: 'https://google.com',
      method: 'get',
      retry: 5,
      retryDelay: 100,
      retryCode: ['ECONNABORTED', 'ETIMEDOUT', 500],
      retryBeforeFn: (e) => {
        console.log(`retry #${e.config.__retryCount}: ${e.config.url} : errCode: ${e.code || (e.response && e.response.status)}`);
      }
    });
  } catch (error) {
    console.log(error);
  }
})();

Option

optiontypedefaultdesc
retrynumber3times to retry
retryDelaynumber50ms time to delay retry
retryCode[number, string]all error codethe match axios error code to retry
retryBeforeFnfunction(config)the function before retry, can get axios config

retryCode list

codetypedesc
'ECONNABORTED'stringtimeout
'ETIMEDOUT'stringtimeout
'ENOTFOUND'stringserver not found
'ENETUNREACH'stringnot reach
4**numberclient error
5**numberserver error

Thinks

Happy to thinks

License

Apache-2.0

Keywords

axios

FAQs

Package last updated on 19 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts