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

fetch-as-curl

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-as-curl

Making a cURL command from fetch API.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

fetch-as-curl

Making cURL command output on browser console when using Fetch API.

Fetures

  • Make a cURL command on browser console.
  • Same interface with Fetch API.

Installation

Using npm.
npm i fetch-as-curl

Example

import "fetch-as-curl";
const options = {
  method: "POST",
  body: JSON.stringify({
    rating: 5,
    comment: "cool!"
  }),
  headers: {
    Authorization: "Bearer foo",
    "Content-Type": "application/json"
  }
}
fetch("http://somesite.com/reviews", options)
  .then(res => /* Do something */)

In console

curl -X POST -H "Authorization: Bearer foo" -H "Content-Type: application/json" -d '{"rating": 5, "comment": "cool!"}' http://somesite.com/some.json

Keywords

FAQs

Package last updated on 01 Feb 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