Created
February 14, 2013 17:16
-
-
Save porsager/4954389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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