Switch from HEAD to GET for latency measurement

Hetzner speed test servers drop the connection on HEAD requests,
causing fetch to throw a network error. GET works universally and
with no-cors mode the response is opaque anyway.
This commit is contained in:
Jeffrey Paul 2026-02-23 01:01:50 +07:00
parent 60372f0708
commit 0bbf4d66a8

View File

@ -125,7 +125,7 @@ async function detectGateway() {
const timeoutId = setTimeout(() => controller.abort(), 1500); const timeoutId = setTimeout(() => controller.abort(), 1500);
try { try {
await fetch(url, { await fetch(url, {
method: "HEAD", method: "GET",
mode: "no-cors", mode: "no-cors",
cache: "no-store", cache: "no-store",
signal: controller.signal, signal: controller.signal,
@ -240,7 +240,7 @@ async function measureLatency(url) {
try { try {
await fetch(targetUrl.toString(), { await fetch(targetUrl.toString(), {
method: "HEAD", method: "GET",
mode: "no-cors", mode: "no-cors",
cache: "no-store", cache: "no-store",
signal: controller.signal, signal: controller.signal,