Created
December 15, 2014 22:03
-
-
Save mrajagopal/c751a7632bdff74feba2 to your computer and use it in GitHub Desktop.
HTTP request generator
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
"use script"; | |
var http = require(http); | |
var request_count = 10; | |
var options = { | |
hostname: '192.0.2.1' | |
port: 80, | |
method: 'GET', | |
path: '/' | |
}; | |
callback = function(response) { | |
var str = ''; | |
response.on('data', function (chunk) { | |
str += chunk; | |
}); | |
response.on('end', function() { | |
console.log(str); | |
}); | |
} | |
for(var i = 0; i < request_count; i++){ | |
http.request(options.callback).end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment