A leaner [superagent] with Promises and streams2+.
More details coming soon™.
var request = require('picoagent');
// Create request from URL
request('http://www.google.ca')
// Use HTTP .VERB syntax
request.post('http://www.google.ca');
// Specify any number of the usual options to http[s].request and some other
// convience properties.
request('http://www.google.ca' {
headers: {
'Accept': '*',
'Content-Type': 'application/json'
},
body: {
foo: 'bar'
}
});
// Use http server middleware
var server = function(request, response) {
response.writeHead(200, { });
response.end('Hello world.');
}
request.get(server, '/foo');
var Agent = require('picoagent');
// Create custom instance
var agent = new Agent();
// Call.
agent.request(...);