| 27 | // Narrow a recorded fetch call to the headers of its RequestInit without |
| 28 | // casting; throws (failing the test) if the call shape is unexpected. |
| 29 | const headersOf = (call: readonly unknown[] | undefined): unknown => { |
| 30 | const init = call?.[1]; |
| 31 | if (init === null || init === undefined || typeof init !== "object" || !("headers" in init)) { |
| 32 | throw new Error("expected fetch to be called with a RequestInit carrying headers"); |
| 33 | } |
| 34 | return init.headers; |
| 35 | }; |
| 36 | |
| 37 | describe("createCloudClient 401-retry decorator", () => { |
| 38 | // The generated client falls back to global fetch when no fetchImpl is |