( url: string, headers: Record<string, string>, timeoutMs: number )
| 296 | // --------------------------------------------------------------------------- |
| 297 | |
| 298 | function httpsGet( |
| 299 | url: string, |
| 300 | headers: Record<string, string>, |
| 301 | timeoutMs: number |
| 302 | ): Promise<{ status: number; headers: Record<string, string | string[] | undefined>; body: string }> { |
| 303 | return new Promise((resolve, reject) => { |
| 304 | const req = https.get(url, { headers }, (res) => { |
| 305 | let body = ''; |
| 306 | res.on('data', (c) => (body += c)); |
| 307 | res.on('end', () => resolve({ status: res.statusCode ?? 0, headers: res.headers, body })); |
| 308 | }); |
| 309 | req.on('error', reject); |
| 310 | req.setTimeout(timeoutMs, () => req.destroy(new Error(`request timed out after ${timeoutMs}ms`))); |
| 311 | }); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Resolve the latest release tag (e.g. `v0.9.9`). |
no test coverage detected