Skip to content

Instantly share code, notes, and snippets.

@mrajagopal
Created December 15, 2014 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrajagopal/c751a7632bdff74feba2 to your computer and use it in GitHub Desktop.
Save mrajagopal/c751a7632bdff74feba2 to your computer and use it in GitHub Desktop.
HTTP request generator
"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