Benchmark 10 requests tiny.tf

9. helmikuuta 2022 | 141 näyttökertaa

  // Benchmarks 10 requests (not very accurate bc basically sending requests to localhost)
  let totalTime = 0

  for (let i = 0; i < 10; i++) {
    const requestStartTime = Date.now();
    await fetch(`http://${requestUrl.hostname}/shorten`, {
      "body": JSON.stringify({
        "url": "https://developers.cloudflare.com/workers/cli-wrangler/commands#kv",
        "test": true
      }),
      "method": "POST",
    })
    totalTime += Date.now() - requestStartTime
  }