We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fetch
1 parent c516f44 commit b2ba578Copy full SHA for b2ba578
test/development/app-dir/dev-fetch-hmr/app/layout.tsx
@@ -4,10 +4,16 @@ import { ReactNode } from 'react'
4
const magicNumber = Math.random()
5
const originalFetch = globalThis.fetch
6
7
-globalThis.fetch = async (
+if (originalFetch.name === 'monkeyPatchedFetch') {
8
+ throw new Error(
9
+ 'Patching over already patched fetch. This creates a memory leak.'
10
+ )
11
+}
12
+
13
+globalThis.fetch = async function monkeyPatchedFetch(
14
resource: URL | RequestInfo,
15
options?: RequestInit
-) => {
16
+) {
17
const request = new Request(resource)
18
19
if (request.url === 'http://fake.url/secret') {
0 commit comments