(url: string, timeoutMs = 15000)
| 50 | } |
| 51 | |
| 52 | export async function fetchText(url: string, timeoutMs = 15000): Promise<string> { |
| 53 | const ctrl = new AbortController(); |
| 54 | const id = setTimeout(() => ctrl.abort(), timeoutMs).unref?.(); |
| 55 | try { |
| 56 | const res = await fetch(url, {signal: ctrl.signal, cache: 'no-store'} as any); |
| 57 | if (!res.ok) { |
| 58 | throw new Error(`HTTP ${res.status} for ${url}`); |
| 59 | } |
| 60 | return await res.text(); |
| 61 | } finally { |
| 62 | clearTimeout(id as any); |
| 63 | } |
| 64 | } |
no outgoing calls
no test coverage detected