minimal-request

Like request, but just what I need for doing simple Get/post reqs

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
minimal-request
3.0.06 years ago8 years agoMinified + gzip package size for minimal-request in KB

Readme

minimal-request Build Status
Greenkeeper badge
NPM
A minimal opinionated dependency-free request client for node.js.
  • It supports just GET and POST
  • It asks for gzip by default
  • When response status is not 200, it returns an error with the status code + the response.
  • Default timeout is 5 seconds. When request timesout, error is 'timeout'

var request = require('minimal-request');

request({
  url: 'https://hello.com/blabla',
  method: 'post',
  body: { hi: 'hello' },
  json: true,
  headers: { 'accept-language': 'en-GB' },
  timeout: 5 // seconds
}, function(err, res, details){
  console.log(err);
  // -> something like 404 or null

  console.log(res);
  // -> Something like {hi: 1234}

  console.log(details);
  // -> Something like { statusCode: 200, headers: { ... }}
});
License
MIT