Registry / devops / r2curl

r2curl

JSON →
library0.2.4jsnpmunverified

r2curl converts Axios request configurations or responses into cURL command strings for debugging. Version 0.2.4 is the latest, released as a stable package. It operates independently of Axios internals, avoiding concurrency issues found in middleware-based alternatives. Currently supports AxiosRequestConfig and AxiosResponse; node-fetch and request support are planned. Ships TypeScript definitions.

npm install r2curl
INSTALL
IMPORT
SIG · R2CURL
R
r2curl
devopsjavascriptv0.2.4
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 r2curl from 'r2curl'
const r2curl = require('r2curl').default
The package has a default export. TypeScript works with both import and require, but import is preferred for ESM.
r2curl
import r2curl from 'r2curl'
import { r2curl } from 'r2curl'
Named import does not exist; the only export is default.
IR2CurlOptions
import type { IR2CurlOptions } from 'r2curl'
import { IR2CurlOptions } from 'r2curl'
Options interface is exported as a type. Use type import for TypeScript.

Converts an Axios response object into a cURL command string and logs it.

import r2curl from 'r2curl'; import axios from 'axios'; const response = await axios.get('https://google.com'); const curl = r2curl(response); console.log(curl);
Debug
Known issues
gotchaOnly supports Axios as of v0.2.4; passing fetch or request objects will fail.
fix
Ensure input is either AxiosRequestConfig or AxiosResponse.
affects: >=0.1.0
gotchaThe function expects a single argument; if called without arguments, it throws an error about undefined.
fix
Always pass a request config or response object.
affects: >=0.1.0
gotchaOption 'quote' only accepts 'single' or 'double'; other values are silently ignored.
fix
Use only 'single' (default) or 'double'.
affects: >=0.1.0
gotchaThe package does not escape certain special characters in header values; may produce malformed curl commands.
fix
Manually verify generated curl for headers with quotes or backslashes.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: r2curl is not a function
Attempting named import instead of default import.
fix
Use `import r2curl from 'r2curl'` (default import).
Cannot read property 'config' of undefined
Passing an undefined or null argument.
fix
Ensure a valid AxiosRequestConfig or AxiosResponse object is passed.
Module '"r2curl"' has no exported member 'r2curl'
Using named import syntax when only default exists.
fix
Use `import r2curl from 'r2curl'`.
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
packager2curl
r2curl — npm install r2curl · libregistry