( urlString: string, agent?: https.Agent, )
| 27 | * @param urlString |
| 28 | */ |
| 29 | export function httpsGetAsync( |
| 30 | urlString: string, |
| 31 | agent?: https.Agent, |
| 32 | ): Promise<IncomingMessage> { |
| 33 | agent = |
| 34 | agent ?? |
| 35 | new https.Agent({ |
| 36 | rejectUnauthorized: false, |
| 37 | }); |
| 38 | |
| 39 | const urlOptions = url.parse(urlString); |
| 40 | const options = {agent, ...urlOptions}; |
| 41 | |
| 42 | return new Promise((resolve, reject) => { |
| 43 | https.get(options, resolve).on('error', reject); |
| 44 | }); |
| 45 | } |
no test coverage detected