207
const opts: https.RequestOptions & { cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' } = {
208
hostname: endpoint.hostname,
209
>
port: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80),
requestService.ts
210
>
protocol: endpoint.protocol,
211
>
path: endpoint.path,
212
>
method: options.type || 'GET',
213
>
headers: options.headers,
214
>
agent: options.agent,
215
>
rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true
216
>
};
217
>
218
>
if (options.user && options.password) {
219
opts.auth = options.user + ':' + options.password;
220
}
222
>
if (options.disableCache) {
223
opts.cache = 'no-store';
224
}
226
>
const req = rawRequest(opts, (res: http.IncomingMessage) => {
227
const followRedirects: number = isNumber(options.followRedirects) ? options.followRedirects : 3;
228
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {