fix: normalize abort signals for fetch

This commit is contained in:
Peter Steinberger committed 2026-01-21 17:29:46 +00:00
1 parent 8aca606a6f
commit 4e1806947d
8 files changed
+81 -9

No files matched your search

+6
View File
@@ -28,3 +28,9 @@ export function wrapFetchWithAbortSignal(fetchImpl: typeof fetch): typeof fetch
}) as typeof fetch;
return Object.assign(wrapped, fetchImpl);
}
export function resolveFetch(fetchImpl?: typeof fetch): typeof fetch | undefined {
const resolved = fetchImpl ?? globalThis.fetch;
if (!resolved) return undefined;
return wrapFetchWithAbortSignal(resolved);
}