diff --git a/src/http.ts b/src/http.ts index 2277148..2ff429f 100644 --- a/src/http.ts +++ b/src/http.ts @@ -15,7 +15,10 @@ export async function fetchJson( url: string | URL, init?: RequestInit, ): Promise { - const resp = await fetch(url, init); + const resp = await fetch(url, { + ...init, + signal: init?.signal ?? AbortSignal.timeout(30_000), + }); if (!resp.ok) throw new HttpError(what, resp.status, await resp.text()); return resp.json() as Promise; }