Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-curlirize

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-curlirize

Axios third-party module to print all axios requests as curl commands in the console.

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-4.1%
Maintainers
1
Weekly downloads
 
Created
Source

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.

The module makes use of axios and axios-middleware.

How it works

Basically, we use the axios-middleware to log the curl commands on every request. As simple as that.

How to use it

axios-curlirize is super easy to use. First you'll have to install it.

npm i --save axios-curlirize

Then all you have to do is import and instanciate curlirize in your app. Here's a sample:

    import axios from 'axios';
    import express from 'express';
    import curlirize from 'axios-curlirize';

    const app = express();

    // initializing axios-curlirize with your axios instance
    curlirize(axios);

    // creating dummy route
    app.post('/', (req, res) => {
        res.send({hello: 'world!'})
    });

    // starting server
    app.listen(7500, () => {
        console.log('Dummy server started in ')
        /*
             The output of this in the console will be :
             curl -X POST  -H "Accept:application/json, text/plain" -H "Content-Type:application/json;charset=utf-8" --data "{\"dummy\":\"data\"}" http://localhost:7500/
        */
        axios.post('http://localhost:7500/', {dummy: 'data'})
            .then((res) => {
                console.log('success');
            })
            .catch((err) => {
                console.log(err);
            });
    });    

Keywords

FAQs

Package last updated on 20 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc