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