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