Installations
npm install axios-curlirize
Developer Guide
Typescript
No
Module System
ESM
Node Version
16.9.1
NPM Version
7.21.1
Score
98
Supply Chain
100
Quality
76.1
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
delirius325
Download Statistics
Total Downloads
4,670,028
Last Day
3,056
Last Week
27,462
Last Month
104,046
Last Year
1,095,502
GitHub Statistics
186 Stars
157 Commits
32 Forks
1 Watching
6 Branches
12 Contributors
Bundle Size
2.05 kB
Minified
905.00 B
Minified + Gzipped
Package Meta Information
Latest Version
2.0.0
Package Id
axios-curlirize@2.0.0
Size
6.95 kB
NPM Version
7.21.1
Node Version
16.9.1
Publised On
22 Oct 2021
Total Downloads
Cumulative downloads
Total Downloads
4,670,028
Last day
-23.6%
3,056
Compared to previous day
Last week
16.4%
27,462
Compared to previous week
Last month
5.2%
104,046
Compared to previous month
Last year
-15.7%
1,095,502
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Description
This module is an axios third-party module to log any axios request as a curl command in the console. It was originally posted as a suggestion on the axios repository, but since we believed it wasn't in the scope of axios to release such feature, we decided to make it as an independent module.
How it works
The module makes use of axios' interceptors to log the request as a cURL command. It also stores it in the response's config object. Therefore, the command can be seen in the app's console, as well as in the res.config.curlCommand
property of the response.
Changing the logger
By default, axios-curlirize uses the console.log/error()
functions. It is possible to change the logger by doing something similar to this:
1// when initiating your curlirize instance 2curlirize(axios, (result, err) => { 3 const { command } = result; 4 if (err) { 5 // use your logger here 6 } else { 7 // use your logger here 8 } 9});
How to use it
axios-curlirize is super easy to use. First you'll have to install it.
1npm i --save axios-curlirize@latest
Then all you have to do is import and instanciate curlirize in your app. Here's a sample:
1import axios from 'axios'; 2import express from 'express'; 3import curlirize from 'axios-curlirize'; 4 5const app = express(); 6 7// initializing axios-curlirize with your axios instance 8curlirize(axios); 9 10// creating dummy route 11app.post('/', (req, res) => { 12 res.send({ hello: 'world!' }); 13}); 14 15// starting server 16app.listen(7500, () => { 17 console.log('Dummy server started on port 7500'); 18 /* 19 The output of this in the console will be : 20 curl -X POST -H "Content-Type:application/x-www-form-urlencoded" --data {"dummy":"data"} http://localhost:7500/ 21 */ 22 axios 23 .post('http://localhost:7500/', { dummy: 'data' }) 24 .then(res => { 25 console.log('success'); 26 }) 27 .catch(err => { 28 console.log(err); 29 }); 30});
Curilirize additional axios instance
To curlirize any other instances of axios (aside from the base one), please call the curlirize()
method on that instance.
1const instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, headers: {'X-Custom-Header': 'foobar'} }); 2curlirize(instance);
Disable the logger
By default, all requests will be logged. But you can disable this behaviour unitarily by setting the curlirize
option to false within the axios request.
1axios 2 .post('http://localhost:7500/', { dummy: 'data' }, { 3 curlirize: false 4 }) 5 .then(res => { 6 console.log('success'); 7 }) 8 .catch(err => { 9 console.log(err); 10 });
Clear a request
1axios 2 .post('http://localhost:7500/', { dummy: 'data' }) 3 .then(res => { 4 res.config.clearCurl(); 5 }) 6 .catch(err => { 7 console.log(err); 8 });
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 3/11 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 24 are checked with a SAST tool
Reason
20 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
2.3
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to axios-curlirize
@types/axios-curlirize
TypeScript definitions for axios-curlirize
@abhishekrajeshirke/axios-curlirize
Axios third-party module to print all axios requests as curl commands in the console.
axios-curlirize2
Fork axios-curlirize with fix some bugs.
curlirize-for-axios
Axios third-party module to print all axios requests as curl commands in the console.