( url: string, headers: Record<string, string>, timeoutMs: number )
| 217 | // --------------------------------------------------------------------------- |
| 218 | |
| 219 | function httpsGet( |
| 220 | url: string, |
| 221 | headers: Record<string, string>, |
| 222 | timeoutMs: number |
| 223 | ): Promise<{ status: number; headers: Record<string, string | string[] | undefined>; body: string }> { |
| 224 | return new Promise((resolve, reject) => { |
| 225 | const req = https.get(url, { headers }, (res) => { |
| 226 | let body = ''; |
| 227 | res.on('data', (c) => (body += c)); |
| 228 | res.on('end', () => resolve({ status: res.statusCode ?? 0, headers: res.headers, body })); |
| 229 | }); |
| 230 | req.on('error', reject); |
| 231 | req.setTimeout(timeoutMs, () => req.destroy(new Error(`request timed out after ${timeoutMs}ms`))); |
| 232 | }); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Resolve the latest release tag (e.g. `v0.9.9`). |
no test coverage detected