( url: string, headers: Record<string, string>, timeoutMs: number )
| 205 | // --------------------------------------------------------------------------- |
| 206 | |
| 207 | function httpsGet( |
| 208 | url: string, |
| 209 | headers: Record<string, string>, |
| 210 | timeoutMs: number |
| 211 | ): Promise<{ status: number; headers: Record<string, string | string[] | undefined>; body: string }> { |
| 212 | return new Promise((resolve, reject) => { |
| 213 | const req = https.get(url, { headers }, (res) => { |
| 214 | let body = ''; |
| 215 | res.on('data', (c) => (body += c)); |
| 216 | res.on('end', () => resolve({ status: res.statusCode ?? 0, headers: res.headers, body })); |
| 217 | }); |
| 218 | req.on('error', reject); |
| 219 | req.setTimeout(timeoutMs, () => req.destroy(new Error(`request timed out after ${timeoutMs}ms`))); |
| 220 | }); |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Resolve the latest release tag (e.g. `v0.9.9`). |
no test coverage detected