Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nuskin/axios-util

Package Overview
Dependencies
Maintainers
5
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuskin/axios-util - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

24

package.json
{
"name": "@nuskin/axios-util",
"version": "2.1.0",
"version": "2.2.0",
"description": "An Axios utility ...",

@@ -22,18 +22,18 @@ "main": "src/index.js",

"devDependencies": {
"axios": "0.27.2",
"axios-mock-adapter": "1.19.0",
"eslint": "7.19.0",
"eslint-config-google": "0.14.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-prettier": "3.3.1",
"jest": "26.6.3",
"axios": "1.5.0",
"axios-mock-adapter": "1.22.0",
"eslint": "8.50.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-json": "3.1.0",
"eslint-plugin-prettier": "5.0.0",
"jest": "29.7.0",
"jest-sonar-reporter": "2.0.0",
"prettier": "2.2.1"
"prettier": "3.0.3"
},
"dependencies": {
"axios-retry": "3.5.0",
"deepmerge": "4.2.2"
"axios-retry": "3.8.0",
"deepmerge": "4.3.1"
},
"peerDependencies": {
"axios": "^0.27.2"
"axios": "^1.5.0"
},

@@ -40,0 +40,0 @@ "files": [

@@ -37,11 +37,28 @@ # @nuskin/axios-util

```js
const { axios, getRetryAxiosInstance } = require('@nuskin/axios-util')
const { getRetryAxiosInstance } = require('@nuskin/axios-util')
// Custom retry delay
let retryDelay = process.env.AXIOS_RETRY_DELAY || 5000
const myAxiosWithRetry = getRetryAxiosInstance({
retries: 3,
shouldResetTimeout: true,
retryDelay: (retryCount) => {
return retryCount * 1000;
}
retries: 3,
shouldResetTimeout: true,
retryDelay: (retryCount) => {
return retryCount * retryDelay
},
retryCondition: (error) => {
// if retry condition is not specified, by default idempotent requests are retried
return error.response?.status >= 500 || error.code === 'ECONNABORTED'
},
onRetry: (retryCount, error, requestConfig) => {
log.info(
{
retryCount,
message: error.message,
statusCode: error.response?.status,
statusText: error.response?.statusText,
responseData: error.response?.data
},
requestConfig.metric
)
return true
}
})

@@ -48,0 +65,0 @@ ```

@@ -14,3 +14,3 @@ 'use strict'

/**
*
*
* @param {Object} options `axios-retry` options to pass in.

@@ -20,3 +20,3 @@ * @returns {AxiosInstance}

const getRetryAxiosInstance = (options = {}) => {
const retryConfig = merge({ retryDelay: axiosRetry.exponentialDelay }, options)
const retryConfig = merge({ retryDelay: axiosRetry.exponentialDelay }, options)
const axiosRetryInstance = axios.create()

@@ -30,2 +30,2 @@ axiosRetry(axiosRetryInstance, retryConfig)

getRetryAxiosInstance
}
}
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