(input, init)
| 24 | const recordingFetch = (respond: (url: string) => Response) => { |
| 25 | const calls: Array<{ url: string; body: unknown; headers: Record<string, string> }> = []; |
| 26 | const fetch: typeof globalThis.fetch = async (input, init) => { |
| 27 | const url = String(input); |
| 28 | calls.push({ |
| 29 | url, |
| 30 | body: typeof init?.body === "string" ? decodeRequestBody(init.body) : undefined, |
| 31 | headers: Object.fromEntries(new Headers(init?.headers).entries()), |
| 32 | }); |
| 33 | return respond(url); |
| 34 | }; |
| 35 | return { calls, fetch }; |
| 36 | }; |
| 37 |
no test coverage detected