Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
HTTP request helper using Node.js
var http = require('http');
function request(options, callback)
http.request(options, function (response) {
var responseBody = '';
response.on('data', function (data) {
responseBody += data;
response.on('end', function () {
response.on('error', function (e) {
throw e;
exports.request = request;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment