It’s on my github page, so get it from there.
https://github.com/cairey/FluentRequestBuilder
The http lib can be a bit low level sometimes, so why not make it simpler. Use like so:
var requestBuilder = require('./requestBuilder');
var data = JSON.stringify({ 'important': 'data' });
var headers = {
'Host': 'www.example.com',
'Cookie': null,
'Content-Type': 'text/plain',
'Content-Length': Buffer.byteLength(data, 'utf8'),
'Accept': '*/*'
};
requestBuilder.withHeaders(headers)
.withData(data)
.withPort(80)
.makeRequest('http://google.com', '/', function(body, response){
console.write(body);
});