Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matteofigus/minimal-request
A minimal opinionated dependency-free request client for node.js
https://github.com/matteofigus/minimal-request
Last synced: 2 months ago
JSON representation
A minimal opinionated dependency-free request client for node.js
- Host: GitHub
- URL: https://github.com/matteofigus/minimal-request
- Owner: matteofigus
- License: mit
- Created: 2016-02-13T14:07:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-21T09:13:13.000Z (over 6 years ago)
- Last Synced: 2024-09-21T07:41:26.665Z (3 months ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
minimal-request [![Build Status](https://secure.travis-ci.org/matteofigus/minimal-request.png?branch=master)](http://travis-ci.org/matteofigus/minimal-request)
===============[![Greenkeeper badge](https://badges.greenkeeper.io/matteofigus/minimal-request.svg)](https://greenkeeper.io/)
[![NPM](https://nodei.co/npm/minimal-request.png?downloads=true)](https://npmjs.org/package/minimal-request)
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'```js
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 nullconsole.log(res);
// -> Something like {hi: 1234}console.log(details);
// -> Something like { statusCode: 200, headers: { ... }}
});
```# License
MIT