Registry / testing / axios-to-curl

axios-to-curl

JSON →
library1.3.5jsnpmunverified

Version 1.3.5. Dev-only debugging module that logs all axios requests as cURL commands to the console. Works in Node.js without ES6 imports, unlike the original axios-curlirize. Uses axios interceptors internally; no production dependencies. No active releases for 2+ years; maintainer recommends testing for current axios versions.

npm install axios-to-curl
INSTALL
IMPORT
SIG · AXIOS-TO-CURL
A
axios-to-curl
testingjavascriptv1.3.5
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.

curlirize
import curlirize from 'axios-to-curl'
import { curlirize } from 'axios-to-curl'
Default export only; named import will fail.
curlirize
const curlirize = require('axios-to-curl')
const { curlirize } = require('axios-to-curl')
CommonJS: destructuring will give undefined. Use default require.
AxiosCurlirizeResult
// Not exported. Use inline type: { command: string; }
No TypeScript types shipped; define your own if needed.

Initializes the interceptor on axios and logs curl commands for all requests. Includes custom logger example.

const axios = require('axios'); const curlirize = require('axios-to-curl'); // Initialize with your axios instance curlirize(axios); // Now every axios request will log a curl command axios.get('https://api.example.com/data', { headers: { 'Authorization': `Bearer ${process.env.API_KEY ?? ''}` } }).then(res => { console.log('Success:', res.data); }).catch(err => { console.error('Error:', err.message); }); // Custom logger: curlirize(axios, (result, err) => { const { command } = result; if (err) { console.error('Curl command failed to generate', err); } else { console.log('cURL:', command); } });
Debug
Known issues
breakingUsing with Axios >=1.0 may cause interceptor conflicts or unexpected behavior.
fix
Pin axios to <1.0.0 or test thoroughly with your version.
affects: >=1.0.0
deprecatedPackage is no longer actively maintained; last release in 2021.
fix
Consider alternatives like axios-curlirize (original) or log-axios-request.
affects: *
gotchaModule mutates the axios instance – calling curlirize() on the same instance multiple times stacks interceptors.
fix
Initialize curlirize only once per axios instance.
affects: *
gotchaCommonJS destructuring import fails silently: const { curlirize } = require('axios-to-curl') gives undefined.
fix
Use default require: const curlirize = require('axios-to-curl').
affects: *
gotchaLogs are printed to console by default; may leak sensitive headers or tokens in production.
fix
Remove curlirize() call in production code or disable via environment condition.
affects: *
Errors
Common errors & fixes
TypeError: curlirize is not a function
Named import used when package exports as default.
fix
Use default import: `import curlirize from 'axios-to-curl'` or `const curlirize = require('axios-to-curl')`
Error: Can't find module 'axios-to-curl' in node_modules
Package not installed or misspelled.
fix
Run `npm install axios-to-curl` and verify the package name in package.json.
TypeError: Cannot read property 'interceptors' of undefined
Passed a non-axios instance or undefined.
fix
Ensure `axios` is required/imported correctly before passing to curlirize().
Upgrade
Version history
1.3.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
axios-to-curl — npm install axios-to-curl · libregistry