fix: honor mocked guarded fetch implementations

This commit is contained in:
Peter Steinberger
2026-04-05 07:39:27 +01:00
parent c09bf9812a
commit c9029503fd

View File

@@ -249,10 +249,10 @@ export async function fetchWithSsrFGuard(params: GuardedFetchOptions): Promise<G
...(signal ? { signal } : {}),
};
const fetcher =
dispatcher && !params.fetchImpl
? (loadUndiciRuntimeDeps().fetch as unknown as FetchLike)
: defaultFetch;
// Keep the caller-provided/global fetch implementation on the hot path so
// tests can stub network behavior while still receiving the pinned
// dispatcher in RequestInit.
const fetcher = defaultFetch;
const response = await fetcher(parsedUrl.toString(), init);
if (isRedirectStatus(response.status)) {