(handler: (url: string, init: RequestInit | undefined) => Response)
| 22 | }); |
| 23 | |
| 24 | const installFetch = (handler: (url: string, init: RequestInit | undefined) => Response) => { |
| 25 | globalThis.fetch = ((input: RequestInfo | URL, init?: RequestInit) => { |
| 26 | const url = |
| 27 | typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url; |
| 28 | return Promise.resolve(handler(url, init)); |
| 29 | }) as typeof fetch; |
| 30 | }; |
| 31 | |
| 32 | const recordCall = (calls: Array<FetchCall>, url: string, init: RequestInit | undefined): void => { |
| 33 | calls.push({ |
no test coverage detected