min-request

Simple request, For people who cannot understand [request](https://github.com/request/request) like me to use http request

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
min-request
101.4.18 years ago8 years agoMinified + gzip package size for min-request in KB

Readme

min-request
!Build statustravis-imagetravis-url !Test coveragecoveralls-imagecoveralls-url !NPM versionnpm-imagenpm-url !Downloadsdownloads-imagedownloads-url
Simple request, For people who cannot understand request like me to use http request

Installation

npm install min-request

Support

Support body types
  • string
  • json
  • stream
  • buffer

Usage

request(url, options, callback)
callback param is just like request@request: err, res, body
Simplest
var request = require('min-request')
request('localhost:8080/test', function(err, res, body) {
    console.log(err, body)
})

Request with data like json, stream
var request = require('min-request')

// json
request('localhost:8080/upload', {
    method: 'POST',
    body: {foo: 'bar'}
},function(err, res, body) {
    // ...
})

// stream
var fs = require('fs')
request('localhost:8080/upload', {
    method: 'POST',
    body: fs.createReadStream('./foo.bar')
}, function(err, res, body) {
    // ...
})

Advanced

use NODE_DEBUG=request to show request options

License

ISC