Registry / testing / jsend-axios

jsend-axios

JSON →
library1.0.3jsnpmunverified

Axios interceptor that wraps responses in JSend format. Version 1.0.3 (latest) — last updated 2019, no recent releases. It attaches an Axios response interceptor to automatically extract the JSend body. Lightweight alternative to manual response handling when using jsend middleware on the server.

npm install jsend-axios
INSTALL
IMPORT
SIG · JSEND-AXIOS
J
jsend-axios
testingjavascriptv1.0.3
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.

JSendInterceptor
import JSendInterceptor from 'jsend-axios'
const JSendInterceptor = require('jsend-axios')
ESM only; CJS require does not work.
JSendInterceptor
import { default as JSendInterceptor } from 'jsend-axios'
Explicit named default import also valid.
JSendInterceptor
const JSendInterceptor = require('jsend-axios').default
const JSendInterceptor = require('jsend-axios')
If using CommonJS, you must access .default.

Installs jsend-axios interceptor on an axios instance, showing how to use it after setup.

import axios from 'axios'; import JSendInterceptor from 'jsend-axios'; const client = axios.create(); JSendInterceptor(client); // Now requests are intercepted: client.get('/api/users').then(response => { console.log(response.data); // { status: 'success', data: {...} } });
Debug
Known issues
breakingModule is ESM-only; CommonJS require will not work without additional configuration.
fix
Use import syntax or const { default: JSendInterceptor } = require('jsend-axios');
affects: >=1.0.0
gotchaInterceptor does not validate JSend format; any server response will be treated as JSend.
fix
Ensure server sends valid JSend responses (status, data, etc.)
affects: >=1.0.0
deprecatedPackage has not been updated since 2019; may not be compatible with modern Axios versions.
fix
Consider alternatives like custom response transformers or manual handling.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: JSendInterceptor is not a function
CommonJS require returns an object with .default property
fix
Use import or const JSendInterceptor = require('jsend-axios').default
Cannot find module 'jsend-axios'
Package is not installed or missing from package.json
fix
Run npm install jsend-axios
Uncaught TypeError: client.interceptors.response.use is not a function
Passed an invalid axios instance (e.g., a plain object)
fix
Ensure you create an axios instance with axios.create()
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
axiosrequiredpeer dependency — interceptor attaches to an axios instance
Agent activity
6 hits · last 30 days
node
6
Resources
jsend-axios — npm install jsend-axios · libregistry