Registry / devops / axios-curlirize

axios-curlirize

JSON →
library2.0.0jsnpmunverified

Axios third-party module that logs all axios requests as curl commands in the console using interceptors. Version 2.0.0 (stable, maintained actively) supports Node.js without requiring ES6 imports and is a fork of the original axios-curlirize. Differentiators: works with additional axios instances, allows per-request disable via config option, and stores curl command in response.config.curlCommand.

npm install axios-curlirize
INSTALL
IMPORT
SIG · AXIOS-CURLIRIZE
A
axios-curlirize
devopsjavascriptv2.0.0
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.

default
import curlirize from 'axios-curlirize'
const { default: curlirize } = require('axios-curlirize')
Default export; use ES import or named require as shown.
CurlirizeResult
import curlirize, { CurlirizeResult } from 'axios-curlirize'
Use named import for TypeScript type.
CurlirizeOptions
import curlirize, { CurlirizeOptions } from 'axios-curlirize'
Use named import for TypeScript type.

Initializes axios-curlirize with the default axios instance, makes a POST request, and logs the equivalent curl command.

import axios from 'axios'; import curlirize from 'axios-curlirize'; // Initialize curlirize with your axios instance curlirize(axios); // Make a request; the curl command will be logged to console axios.post('https://httpbin.org/post', { foo: 'bar' }) .then(res => { // Access the curl command from response console.log(res.config.curlCommand); });
Debug
Known issues
gotchaaxios must be installed as a separate dependency; it is not bundled.
fix
Run `npm install axios` alongside axios-curlirize.
affects: >=1.0.0
gotchaFor Node.js < 14, ensure you use a compatible version or transpile with Babel.
fix
Upgrade Node.js to version 14 or later, or use a bundler like webpack with the appropriate targets.
affects: >=2.0.0
gotchaDisabling per request: set `curlirize: false` in the request config, not `curlirize: { enabled: false }`.
fix
Use `axios.post(url, data, { curlirize: false })`.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'axios'
axios is not installed as a dependency.
fix
Install axios: `npm install axios`.
curlirize is not a function
Incorrect import syntax, especially in CommonJS.
fix
Use `const curlirize = require('axios-curlirize').default;` or ES import as shown in the docs.
Cannot read property 'interceptors' of undefined
Passed a mock or incorrect axios instance to curlirize.
fix
Ensure you pass the actual axios instance or a properly created instance via `axios.create()`.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
axiosrequiredpeer dependency; must be installed separately as it intercepts axios requests
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
axios-curlirize — npm install axios-curlirize · libregistry