Skip to content

QsonXu/min-request

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status NPM version Downloads

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) {
    // ...
})

License

ISC

About

Simplest HTTP request client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%