Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@nuskin/axios-util
Advanced tools
axios-util
enables you to utilize Axios as you normally would. By default, axios-util
sets
the timeout to 10000ms.
Retry functionality is implemented using the axios-retry module. Utilize getRetryAxiosInstance()
to obtain an Axios instance with retry capabilities. All default settings of axios-retry
are applied, except for the retryDelay, which is set to axiosRetry.exponentialDelay. You can customize the retry behavior by supplying an axios-retry
options object to getRetryAxiosInstance()
.
Using npm:
npm install @nuskin/axios-util
Using yarn:
yarn add @nuskin/axios-util
For ESM syntax, use import
:
import { axios, getRetryAxiosInstance } from '@nuskin/axios-util'
For CommonJS, use require
:
const { axios, getRetryAxiosInstance } = require('@nuskin/axios-util')
To customize the retry logic, access axios-retry
with ESM import syntax:
let retryDelay = process.env.AXIOS_RETRY_DELAY || 5000
const myAxiosWithRetry = getRetryAxiosInstance({
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) => {
console.log(
{
retryCount,
message: error.message,
statusCode: error.response?.status,
statusText: error.response?.statusText,
responseData: error.response?.data
},
requestConfig.metric
)
return true;
}
})
FAQs
An Axios utility ...
The npm package @nuskin/axios-util receives a total of 1,241 weekly downloads. As such, @nuskin/axios-util popularity was classified as popular.
We found that @nuskin/axios-util demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.