silverwolf-x's picture
download
raw
836 Bytes
import React from 'react'
import { ReactNode } from 'react'
const magicNumber = Math.random()
const originalFetch = globalThis.fetch
if (originalFetch.name === 'monkeyPatchedFetch') {
throw new Error(
'Patching over already patched fetch. This creates a memory leak.'
)
}
globalThis.fetch = async function monkeyPatchedFetch(
resource: URL | RequestInfo,
options?: RequestInit
) {
const request = new Request(resource)
if (request.url === 'http://fake.url/secret') {
return new Response('monkey patching is fun')
}
if (request.url === 'http://fake.url/magic-number') {
return new Response(magicNumber.toString())
}
return originalFetch(resource, options)
}
export default function Root({ children }: { children: ReactNode }) {
return (
<html>
<body>{children}</body>
</html>
)
}

Xet Storage Details

Size:
836 Bytes
·
Xet hash:
291a6cf7c77efa9428587505df0239f39f940ce3a53f25a8f20aef41b555b2bc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.