1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | const http = require("http");
|
8 | const https = require("https");
|
9 | const url = require("url");
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function httpGetAsync(urlString) {
|
15 | return new Promise((resolve, reject) => {
|
16 | http.get(urlString, resolve).on('error', reject);
|
17 | });
|
18 | }
|
19 | exports.httpGetAsync = httpGetAsync;
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | function httpsGetAsync(urlString) {
|
25 | const agent = new https.Agent({
|
26 | rejectUnauthorized: false,
|
27 | });
|
28 | const urlOptions = url.parse(urlString);
|
29 | const options = Object.assign({ agent }, urlOptions);
|
30 | return new Promise((resolve, reject) => {
|
31 | https.get(options, resolve).on('error', reject);
|
32 | });
|
33 | }
|
34 | exports.httpsGetAsync = httpsGetAsync;
|
35 |
|
\ | No newline at end of file |