( url: string, options?: RequestOptions )
| 35 | } |
| 36 | |
| 37 | export function httpsGet( |
| 38 | url: string, |
| 39 | options?: RequestOptions |
| 40 | ): Promise<PromisifiedResponse> { |
| 41 | const parsedUrl = new URL(url) |
| 42 | const resolvedOptions = Object.assign( |
| 43 | {}, |
| 44 | urlToHttpOptions(parsedUrl), |
| 45 | options |
| 46 | ) |
| 47 | |
| 48 | return new Promise((resolve, reject) => { |
| 49 | const req = https.get(resolvedOptions, async (res) => { |
| 50 | res.setEncoding('utf8') |
| 51 | const resBody = await getIncomingMessageBody(res) |
| 52 | resolve({ req, res, resBody, url, options: resolvedOptions }) |
| 53 | }) |
| 54 | |
| 55 | req.on('error', reject) |
| 56 | }) |
| 57 | } |
| 58 | |
| 59 | export function httpRequest( |
| 60 | url: string, |
no test coverage detected
searching dependent graphs…