1.0.2 • Published 9 years ago

webclient v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

webclient

npm install --save webclient

API

var req = new WebClient();
req.get(opts) -> Promise(result <- [response, body])
req.post(opts) -> Promise(result <- [response, body])

opts.method <- defaults to GET
opts.url <- http://google.com
opts.qs <- query string - object {name: value}
opts.form <- form data - object {name: value}
opts.jar <- tough-cookie-filestore, mongo-cookie-monster, redis-cookie-monster or any other compatible module
opts.timeout <- in ms - defaults to 30000
opts.followRedirect <- bool - defaults to true
opts.gzip <- bool
opts.proxy <- proxy ip:port format
opts.localAddress <- bind ip address
opts.headers <- object {headerName: headerValue}

Examples

You can find more wild examples in /tests folder

var WebClient = require('../');

WebClient.get({
    url: 'http://mail.yahoo.com'
}).then(function(result) {
    let response = result[0], body = result[1];
    response.body = body.length;
    // console.log(response);

    console.log(response);
}).catch(function(err) {
    console.log(err.stack);
});
1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.11

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago