Skip to content

Instantly share code, notes, and snippets.

@porsager
Created February 14, 2013 17:16
Show Gist options
  • Save porsager/4954389 to your computer and use it in GitHub Desktop.
Save porsager/4954389 to your computer and use it in GitHub Desktop.
var http = require('http');
var agent = new http.Agent();
var makeRequestOne = function(){
var req = http.request({
hostname: 'persistenttest.jit.su',
agent: agent
}, function(res){
res.on('data', function(chunk){
console.log(chunk.toString());
makeRequestTwo();
});
});
req.on('error', function(e){
console.log(e);
});
req.end();
};
var makeRequestTwo = function(){
var req = http.request({
hostname: 'persistenttest.jit.su',
agent: agent
}, function(res){
res.on('data', function(chunk){
console.log(chunk.toString());
});
});
req.on('error', function(e){
console.log(e);
});
req.end();
};
makeRequestOne();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment