HTTP Client Utilities
Usage
Basic
var Nipple = require('nipple');
Nipple.get('https://google.com/', function (err, res, payload) {
});
Advanced
var Nipple = require('nipple');
var Http = require('http');
var method = 'GET';
var uri = 'https://google.com/';
var readableStream = Nipple.toReadableStream('foo=bar');
var options = {
payload: readableStream || 'foo=bar' || new Buffer('foo=bar'),
headers: { },
redirects: 3,
timeout: 1000,
maxBytes: 1048576,
rejectUnauthorized: true || false,
downstreamRes: null,
agent: null
};
var optionalCallback = function (err, res) {
Nipple.read(res, function (err, body) {
});
};
Nipple.request(method, uri, options, optionalCallback);
Stream Dependencies
var Nipple = require('nipple');
Nipple.get('http://google.com', { downstreamRes: dependentStream }, function (err, res) {
expect(err).to.not.exist;
res.pipe(dependentStream);
});