Skip to content

Instantly share code, notes, and snippets.

@JosiasAurel
Last active May 18, 2023 15:50
Show Gist options
  • Save JosiasAurel/d0c7b2de6c0b35abb94c07bf327e57ca to your computer and use it in GitHub Desktop.
Save JosiasAurel/d0c7b2de6c0b35abb94c07bf327e57ca to your computer and use it in GitHub Desktop.
A script I use to hit the sinerider-scoring service with sveral requests locally for testing
async function hitService(numRequests) {
const level = "https://sinerider.hackclub.dev/?N4IgbiBcAMB0CMAaEA7AlgYwNZRAZQBkB5ABQFEB9AOTIHEBBAFQEkA1MkZDAewFsAHADYBTAC7CAJlFEAnAK7DkAZwCGYSQRXiAHrgC0u5AHNuKwUqgo5gwQF8gA===";
for (let i = 0; i < numRequests; i++) {
console.log("Making request");
const req = await fetch("https://sinerider-scoring-od9e5.ondigitalocean.app/score", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ level, player: "_frozenbird" })
});
console.log("Awaiting response");
const res = await req.json();
console.log(res)
}
}
const reqCount = process.argv.slice(2)[0];
hitService(Number(reqCount));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment