Socket
Socket
Sign inDemoInstall

get-it

Package Overview
Dependencies
Maintainers
6
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-it

Generic HTTP request library for node and browsers


Version published
Weekly downloads
357K
decreased by-15.94%
Maintainers
6
Weekly downloads
 
Created

What is get-it?

get-it is a JavaScript HTTP client for making requests to APIs. It is designed to be modular and extensible, allowing developers to customize its behavior through plugins.

What are get-it's main functionalities?

Basic GET Request

This feature allows you to make a basic GET request to a specified URL. The response is handled using Promises.

const getIt = require('get-it');
const request = getIt();

request({ url: 'https://api.example.com/data' })
  .then(response => console.log(response))
  .catch(error => console.error(error));

Using Plugins

get-it supports middleware plugins to extend its functionality. In this example, the jsonResponse plugin is used to automatically parse JSON responses.

const getIt = require('get-it');
const jsonResponse = require('get-it/lib/middleware/jsonResponse');
const request = getIt([jsonResponse()]);

request({ url: 'https://api.example.com/data' })
  .then(response => console.log(response))
  .catch(error => console.error(error));

Custom Headers

You can add custom headers to your requests. This is useful for adding authentication tokens or other custom headers required by the API.

const getIt = require('get-it');
const request = getIt();

request({
  url: 'https://api.example.com/data',
  headers: { 'Authorization': 'Bearer token' }
})
  .then(response => console.log(response))
  .catch(error => console.error(error));

Other packages similar to get-it

Keywords

FAQs

Package last updated on 08 May 2020

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