Registry / devops / axios-enhance-adapter

axios-enhance-adapter

JSON →
library0.1.6jsnpmunverified

An axios adapter that prevents duplicate requests and provides automatic error retry for GET requests. Current stable version is 0.1.6, released as an early-stage package with limited maintenance. Key differentiator: simple drop-in adapter replacing axios's default adapter to deduplicate concurrent identical requests and retry on failure. However, it only supports axios <=0.27.2 and lacks active development or community adoption.

npm install axios-enhance-adapter
INSTALL
IMPORT
SIG · AXIOS-ENHANCE-ADAP
A
axios-enhance-adapter
devopsjavascriptv0.1.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getEnhanceAdapter
import { getEnhanceAdapter } from 'axios-enhance-adapter'
const { getEnhanceAdapter } = require('axios-enhance-adapter')
TypeScript/ESM module. Use named import; default import is not available.
EnhanceAdapterOptions
import type { EnhanceAdapterOptions } from 'axios-enhance-adapter'
Type-only import for TypeScript users. The options interface is not exported as a value.
AxiosRequestConfig
import { AxiosRequestConfig } from 'axios'
import { AxiosRequestConfig } from 'axios-enhance-adapter'
AxiosRequestConfig is from 'axios', not from this package.

Creates an axios instance with the enhance adapter that deduplicates concurrent GET requests and retries on failure up to 3 times.

import { getEnhanceAdapter } from 'axios-enhance-adapter'; import axios from 'axios'; const axiosInstance = axios.create({ baseURL: 'http://example.com', adapter: getEnhanceAdapter({ shouldRetryOnError: (err) => err.status !== 401, errorRetryInterval: 2000, errorRetryCount: 3, checkEnable: (config) => config.method?.toLowerCase() === 'get', getKey: (config) => config.url ?? '', }), }); // Only one GET request will be sent, others reuse the response await Promise.all([1, 2, 3].map(() => axiosInstance.get('/data')));
Debug
Known issues
breakingOnly works with axios <= 0.27.2. Breaking changes in axios 0.28+ may break this adapter.
fix
Pin axios to 0.27.2 or earlier.
affects: >=0.1.0
gotchaThe adapter only deduplicates requests that have the same key (default uses method, url, data, params). Different keys will not be deduplicated.
fix
Customize getKey to include all relevant parts of the request.
affects: >=0.1.0
gotchaRequest deduplication is per adapter instance; multiple axios instances with their own adapter will not share deduplication.
fix
Use a single shared axios instance for deduplication across the app.
affects: >=0.1.0
breakingcheckEnable and shouldRetryOnError options are evaluated per request; passing them in request config (overriding defaults) works but may cause unexpected behavior if not careful.
fix
Document per-request overrides clearly.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: adapter is not a function
getEnhanceAdapter returns an adapter factory, but may be passed directly as adapter.
fix
Use `adapter: getEnhanceAdapter(options)` not `adapter: getEnhanceAdapter`.
Module not found: Can't resolve 'axios-enhance-adapter'
Package not installed or path incorrect.
fix
Run `npm install axios-enhance-adapter` and ensure import path is correct.
Error: Cannot find module 'axios'
axios peer dependency not installed.
fix
Install axios: `npm install axios@0.27.2`.
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
axiosrequiredpeer dependency required for the adapter to work
Agent activity
24 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
axios-enhance-adapter — npm install axios-enhance-adapter · libregistry