Skip to content

Instantly share code, notes, and snippets.

@mattwelke
Created March 1, 2017 03:04
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 mattwelke/bf3efa62bab2194d4b679c1f69957d2a to your computer and use it in GitHub Desktop.
Save mattwelke/bf3efa62bab2194d4b679c1f69957d2a to your computer and use it in GitHub Desktop.
HTTP serial load tester
#!/usr/bin/nodejs
const axios = require('axios');
let count = 0;
const uri = process.argv[2];
console.log(`Starting with uri = ${uri}.`);
let timeBefore = undefined;
let timeAfter = undefined;
function hit() {
timeBefore = new Date();
axios.get(uri)
.then(response => {
count++;
timeAfter = new Date();
console.log(`#${count} - ${response.status} ${response.statusText} response in ${timeAfter - timeBefore} ms`);
timeBefore = timeAfter;
hit();
});
}
hit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment