| 58 | * `Response.headers` already lower-cases, but we normalise explicitly |
| 59 | * to stay robust against test mocks that construct `Headers` loosely. */ |
| 60 | const readHeader = (headers: Readonly<Record<string, string>>, name: string): string | null => { |
| 61 | const direct = headers[name]; |
| 62 | if (direct !== undefined) return direct; |
| 63 | const lower = name.toLowerCase(); |
| 64 | for (const [k, v] of Object.entries(headers)) { |
| 65 | if (k.toLowerCase() === lower) return v; |
| 66 | } |
| 67 | return null; |
| 68 | }; |
| 69 | |
| 70 | class ProbeTransportError extends Data.TaggedError("ProbeTransportError")<{ |
| 71 | readonly reason: string; |