Socket
Socket
Sign inDemoInstall

retry-axios

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retry-axios - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

build/src/index.js

@@ -29,3 +29,3 @@ "use strict";

function onError(err) {
const config = err.config.raxConfig || {};
const config = getConfig(err) || {};
config.currentRetryAttempt = config.currentRetryAttempt || 0;

@@ -32,0 +32,0 @@ config.retry =

{
"name": "retry-axios",
"version": "1.0.1",
"version": "1.0.2",
"description": "Retry HTTP requests with Axios.",

@@ -17,11 +17,10 @@ "main": "./build/src/index.js",

"clean": "gts clean",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json",
"codecov": "c8 report --reporter=json && codecov -f coverage/*.json",
"fix": "gts fix",
"compile": "tsc -p .",
"umd": "rm -rf umd && babel build/src -d umd --source-maps",
"test": "nyc mocha build/test --timeout 5000 --require source-map-support/register",
"test": "c8 mocha build/test --timeout 5000 --require source-map-support/register",
"prepare": "npm run compile",
"pretest": "npm run compile",
"license-check": "jsgl --local .",
"commitlint": "git log -1 --pretty=%B | commitlint"
"license-check": "jsgl --local ."
},

@@ -40,21 +39,19 @@ "keywords": [

"devDependencies": {
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@commitlint/cli": "^7.3.2",
"@commitlint/config-conventional": "^7.3.1",
"@types/mocha": "^5.2.5",
"@types/nock": "^9.3.0",
"@types/node": "^10.5.4",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@types/mocha": "^5.2.7",
"@types/nock": "^10.0.3",
"@types/node": "^12.0.4",
"axios": "^0.18.0",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"codecov": "^3.0.4",
"c8": "^7.0.0",
"codecov": "^3.5.0",
"gts": "^1.0.0",
"js-green-licenses": "^0.5.0",
"mocha": "^6.0.0",
"nock": "^10.0.0",
"nyc": "^14.0.0",
"semantic-release": "^15.13.3",
"source-map-support": "^0.5.6",
"typescript": "~3.4.0"
"js-green-licenses": "^1.0.0",
"mocha": "^7.0.0",
"nock": "^11.0.0",
"semantic-release": "^16.0.0",
"source-map-support": "^0.5.12",
"typescript": "~3.7.0"
},

@@ -64,3 +61,3 @@ "files": [

],
"nyc": {
"c8": {
"exclude": [

@@ -67,0 +64,0 @@ "build/test"

# retry-axios
> Use Axios interceptors to automatically retry failed requests. Super flexible. Built in exponential backoff.
> Use Axios interceptors to automatically retry failed requests. Super flexible. Built in exponential backoff.
[![NPM Version][npm-image]][npm-url]

@@ -13,6 +14,10 @@ [![CircleCI][circle-image]][circle-url]

``` sh
```sh
npm install retry-axios
```
### Note:
Currenlty, this library will not work with `axios 0.19.0` because of a known bug in axios itself. See more details [bug](https://github.com/axios/axios/issues/2203)
## Usage

@@ -25,3 +30,3 @@

const rax = require('retry-axios');
const {axios} = require('axios');
const { axios } = require('axios');
```

@@ -78,3 +83,3 @@

// retry attempts have been made
onRetryAttempt: (err) => {
onRetryAttempt: err => {
const cfg = rax.getConfig(err);

@@ -93,3 +98,3 @@ console.log(`Retry attempt #${cfg.currentRetryAttempt}`);

raxConfig: {
onRetryAttempt: (err) => {
onRetryAttempt: err => {
return new Promise((resolve, reject) => {

@@ -99,3 +104,3 @@ // call a custom asynchronous function

if (!error) {
window.localStorage.setItem('token',token);
window.localStorage.setItem('token', token);
resolve();

@@ -105,3 +110,3 @@ } else {

}
})
});
});

@@ -120,3 +125,3 @@ }

// Override the decision making process on if you should retry
shouldRetry: (err) => {
shouldRetry: err => {
const cfg = rax.getConfig(err);

@@ -131,5 +136,6 @@ return true;

This library attaches an `interceptor` to an axios instance you pass to the API. This way you get to choose which version of `axios` you want to run, and you can compose many interceptors on the same request pipeline.
This library attaches an `interceptor` to an axios instance you pass to the API. This way you get to choose which version of `axios` you want to run, and you can compose many interceptors on the same request pipeline.
## License
[Apache-2.0](LICENSE)

@@ -136,0 +142,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc