* During server-side page load, we injected a that wraps `window.fetch` so that * before a `fetch` call is forwarded to the original `window.fetch`, a function we control * is also invoked. This function is put onto the global object (`window._sentryFetchProxy`) * so that we can access i
()
| 64 | * @returns the function that was previously on `window.fetch`. |
| 65 | */ |
| 66 | function switchToFetchProxy(): typeof fetch | undefined { |
| 67 | const globalWithSentryFetchProxy: WindowWithSentryFetchProxy = WINDOW; |
| 68 | |
| 69 | // eslint-disable-next-line @typescript-eslint/unbound-method |
| 70 | const actualFetch = globalWithSentryFetchProxy.fetch; |
| 71 | |
| 72 | if (globalWithSentryFetchProxy._sentryFetchProxy && actualFetch) { |
| 73 | globalWithSentryFetchProxy.fetch = globalWithSentryFetchProxy._sentryFetchProxy; |
| 74 | return actualFetch; |
| 75 | } |
| 76 | return undefined; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Restores the function @param actualFetch to `window.fetch` |