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

request-light

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-light

Lightweight request library. Promise based, with proxy support.

  • 0.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
814K
decreased by-4.84%
Maintainers
0
Weekly downloads
 
Created

What is request-light?

The request-light npm package is a lightweight HTTP client for making HTTP requests. It is designed to be simple and efficient, providing basic functionalities for making GET, POST, PUT, and DELETE requests.

What are request-light's main functionalities?

GET Request

This feature allows you to make a GET request to a specified URL and handle the response.

const request = require('request-light');
request.xhr({ url: 'https://api.example.com/data', type: 'GET' }).then(response => {
  console.log(response.responseText);
}).catch(error => {
  console.error(error);
});

POST Request

This feature allows you to make a POST request to a specified URL with a JSON payload.

const request = require('request-light');
request.xhr({ url: 'https://api.example.com/data', type: 'POST', data: JSON.stringify({ key: 'value' }) }).then(response => {
  console.log(response.responseText);
}).catch(error => {
  console.error(error);
});

PUT Request

This feature allows you to make a PUT request to a specified URL with a JSON payload to update existing data.

const request = require('request-light');
request.xhr({ url: 'https://api.example.com/data/1', type: 'PUT', data: JSON.stringify({ key: 'newValue' }) }).then(response => {
  console.log(response.responseText);
}).catch(error => {
  console.error(error);
});

DELETE Request

This feature allows you to make a DELETE request to a specified URL to delete existing data.

const request = require('request-light');
request.xhr({ url: 'https://api.example.com/data/1', type: 'DELETE' }).then(response => {
  console.log(response.responseText);
}).catch(error => {
  console.error(error);
});

Other packages similar to request-light

FAQs

Package last updated on 02 Jul 2024

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