2 /*---------------------------------------------------------------------------------------------
3 * Copyright (c) Microsoft Corporation. All rights reserved.
4 * Licensed under the MIT License. See License.txt in the project root for license information.
5 *--------------------------------------------------------------------------------------------*/
6 Object.defineProperty(exports, "__esModule", { value: true });
7 function configure(_proxyUrl, _strictSSL) {
9 exports.configure = configure;
10 async function xhr(options) {
11 const requestHeaders = new Headers(options.headers || {});
12 if (options.user && options.password) {
13 requestHeaders.set('Authorization', 'Basic ' + btoa(options.user + ":" + options.password));
17 redirect: options.followRedirects > 0 ? 'follow' : 'manual',
19 headers: requestHeaders
21 const requestInfo = new Request(options.url, requestInit);
22 const response = await fetch(requestInfo);
23 const resposeHeaders = {};
24 for (let name in response.headers) {
25 resposeHeaders[name] = response.headers.get(name);
28 responseText: await response.text(),
29 status: response.status,
30 headers: resposeHeaders