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

httpreq

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpreq

node-httpreq is a node.js library to do HTTP(S) requests the easy way

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is httpreq?

The httpreq npm package is a module that provides a simple interface for making HTTP requests in Node.js. It is designed to make HTTP calls straightforward by handling the complexities of Node's native http module.

What are httpreq's main functionalities?

GET requests

This feature allows you to perform HTTP GET requests to retrieve data from a specified URL.

httpreq.get('http://example.com', function (err, res){
  if (err) return console.error(err);
  console.log(res.body);
});

POST requests

This feature enables you to send HTTP POST requests with parameters to a specified URL, which can be used for submitting form data or interacting with REST APIs.

httpreq.post('http://example.com', {
  parameters: {
    key1: 'value1',
    key2: 'value2'
  }
}, function (err, res){
  if (err) return console.error(err);
  console.log(res.body);
});

Custom headers

This feature allows you to set custom headers for your HTTP requests, which can be necessary for APIs that require specific headers for authentication or content negotiation.

httpreq.get('http://example.com', {
  headers: {
    'User-Agent': 'My Custom User Agent'
  }
}, function (err, res){
  if (err) return console.error(err);
  console.log(res.headers);
});

File uploads

This feature is used to upload files to a server. It supports multipart form data, which is commonly used for file uploads in web forms.

httpreq.post('http://example.com/upload', {
  files: {
    file1: '/path/to/file1.txt',
    file2: '/path/to/file2.jpg'
  }
}, function (err, res){
  if (err) return console.error(err);
  console.log(res.body);
});

Other packages similar to httpreq

FAQs

Package last updated on 28 Sep 2023

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