Created
March 1, 2017 03:04
-
-
Save mattwelke/bf3efa62bab2194d4b679c1f69957d2a to your computer and use it in GitHub Desktop.
HTTP serial load tester
This file contains hidden or 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
#!/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