mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Ops] Upgrade to axios 1.4 (#163732)
## Summary upgrade `axios` to 1.4 - adjust to header usage, and config optionality - Axios' adapters are now resolved from a string key by axios, no need to import/instantiate adapters - most of the changed code stems from changes in Axios' types - `response.config` is now optional - there was a change in the type of AxiosHeaders <-> InternalAxiosHeaders Closes: #162661 Closes: #162414 --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
7df1cee163
commit
9d2696b5c5
26 changed files with 80 additions and 67 deletions
|
@ -808,7 +808,7 @@
|
|||
"antlr4ts": "^0.5.0-alpha.3",
|
||||
"archiver": "^5.3.1",
|
||||
"async": "^3.2.3",
|
||||
"axios": "^0.27.2",
|
||||
"axios": "^1.4.0",
|
||||
"base64-js": "^1.3.1",
|
||||
"bitmap-sdf": "^1.0.3",
|
||||
"blurhash": "^2.0.1",
|
||||
|
|
|
@ -18,9 +18,6 @@ import { REPO_ROOT, kibanaPackageJson } from '@kbn/repo-info';
|
|||
import { parseConfig, Config, CiStatsMetadata } from '@kbn/ci-stats-core';
|
||||
import type { SomeDevLog } from '@kbn/some-dev-log';
|
||||
|
||||
// @ts-expect-error not "public", but necessary to prevent Jest shimming from breaking things
|
||||
import httpAdapter from 'axios/lib/adapters/http';
|
||||
|
||||
import type { CiStatsTestGroupInfo, CiStatsTestRun } from './ci_stats_test_group_types';
|
||||
|
||||
const BASE_URL = 'https://ci-stats.kibana.dev';
|
||||
|
@ -375,7 +372,7 @@ export class CiStatsReporter {
|
|||
headers,
|
||||
data: body,
|
||||
params: query,
|
||||
adapter: httpAdapter,
|
||||
adapter: 'http',
|
||||
|
||||
// if it can be serialized into a string, send it
|
||||
maxBodyLength: Infinity,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import Url from 'url';
|
||||
|
||||
import Axios, { AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import Axios, { AxiosRequestConfig, AxiosInstance, AxiosHeaders, AxiosHeaderValue } from 'axios';
|
||||
import { isAxiosResponseError, isAxiosRequestError } from '@kbn/dev-utils';
|
||||
import { ToolingLog } from '@kbn/tooling-log';
|
||||
|
||||
|
@ -130,7 +130,7 @@ export class GithubApi {
|
|||
): Promise<{
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers: Record<string, string | string[] | undefined>;
|
||||
headers: Record<string, AxiosHeaderValue | undefined>;
|
||||
data: T;
|
||||
}> {
|
||||
const executeRequest = !this.dryRun || options.safeForDryRun;
|
||||
|
@ -145,7 +145,7 @@ export class GithubApi {
|
|||
return {
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {},
|
||||
headers: new AxiosHeaders(),
|
||||
data: dryRunResponse,
|
||||
};
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ export class GithubApi {
|
|||
const githubApiFailed = isAxiosResponseError(error) && error.response.status >= 500;
|
||||
const errorResponseLog =
|
||||
isAxiosResponseError(error) &&
|
||||
`[${error.config.method} ${error.config.url}] ${error.response.status} ${error.response.statusText} Error`;
|
||||
`[${error.config?.method} ${error.config?.url}] ${error.response.status} ${error.response.statusText} Error`;
|
||||
|
||||
if ((unableToReachGithub || githubApiFailed) && attempt < maxAttempts) {
|
||||
const waitMs = 1000 * attempt;
|
||||
|
|
|
@ -43,6 +43,13 @@ module.exports = (request, options) => {
|
|||
return module.exports(request.replace('@elastic/eui/lib/', '@elastic/eui/test-env/'), options);
|
||||
}
|
||||
|
||||
if (request === 'axios') {
|
||||
return resolve.sync('axios/dist/node/axios.cjs', {
|
||||
basedir: options.basedir,
|
||||
extensions: options.extensions,
|
||||
});
|
||||
}
|
||||
|
||||
if (request === `elastic-apm-node`) {
|
||||
return APM_AGENT_MOCK;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import { KbnClientRequesterError } from './kbn_client_requester_error';
|
|||
|
||||
const isConcliftOnGetError = (error: any) => {
|
||||
return (
|
||||
isAxiosResponseError(error) && error.config.method === 'GET' && error.response.status === 409
|
||||
isAxiosResponseError(error) && error.config?.method === 'GET' && error.response.status === 409
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@ import Axios from 'axios';
|
|||
import { isAxiosResponseError } from '@kbn/dev-utils';
|
||||
import { ToolingLog } from '@kbn/tooling-log';
|
||||
|
||||
// https://github.com/axios/axios/tree/ffea03453f77a8176c51554d5f6c3c6829294649/lib/adapters
|
||||
// @ts-expect-error untyped internal module used to prevent axios from using xhr adapter in tests
|
||||
import AxiosHttpAdapter from 'axios/lib/adapters/http';
|
||||
|
||||
import { mkdirp } from './fs';
|
||||
|
||||
function tryUnlink(path: string) {
|
||||
|
@ -78,7 +74,7 @@ export async function downloadToDisk({
|
|||
const response = await Axios.request({
|
||||
url,
|
||||
responseType: 'stream',
|
||||
adapter: AxiosHttpAdapter,
|
||||
adapter: 'http',
|
||||
});
|
||||
|
||||
if (response.status !== 200) {
|
||||
|
@ -171,7 +167,7 @@ export async function downloadToString({
|
|||
const resp = await Axios.request<string>({
|
||||
url,
|
||||
method: 'GET',
|
||||
adapter: AxiosHttpAdapter,
|
||||
adapter: 'http',
|
||||
responseType: 'text',
|
||||
validateStatus: !expectStatus ? undefined : (status) => status === expectStatus,
|
||||
});
|
||||
|
|
|
@ -53,9 +53,6 @@ const UNAUTHORIZED_CA = fsReadFileSync(UNAUTHORIZED_CA_FILE);
|
|||
const Auth = 'elastic:changeme';
|
||||
const AuthB64 = Buffer.from(Auth).toString('base64');
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const AxiosDefaultsAadapter = require('axios/lib/adapters/http');
|
||||
|
||||
describe('axios connections', () => {
|
||||
let testServer: http.Server | https.Server | null;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
@ -65,7 +62,7 @@ describe('axios connections', () => {
|
|||
// needed to prevent the dreaded Error: Cross origin http://localhost forbidden
|
||||
// see: https://github.com/axios/axios/issues/1754#issuecomment-572778305
|
||||
savedAxiosDefaultsAdapter = axios.defaults.adapter;
|
||||
axios.defaults.adapter = AxiosDefaultsAadapter;
|
||||
axios.defaults.adapter = 'http';
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -39,9 +39,6 @@ const CA = fsReadFileSync(CA_FILE, 'utf8');
|
|||
const Auth = 'elastic:changeme';
|
||||
const AuthB64 = Buffer.from(Auth).toString('base64');
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const AxiosDefaultsAadapter = require('axios/lib/adapters/http');
|
||||
|
||||
const ServerResponse = 'A unique response returned by the server!';
|
||||
|
||||
describe('axios connections', () => {
|
||||
|
@ -53,7 +50,7 @@ describe('axios connections', () => {
|
|||
// needed to prevent the dreaded Error: Cross origin http://localhost forbidden
|
||||
// see: https://github.com/axios/axios/issues/1754#issuecomment-572778305
|
||||
savedAxiosDefaultsAdapter = axios.defaults.adapter;
|
||||
axios.defaults.adapter = AxiosDefaultsAadapter;
|
||||
axios.defaults.adapter = 'http';
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -6,7 +6,14 @@
|
|||
*/
|
||||
|
||||
import { isObjectLike, isEmpty } from 'lodash';
|
||||
import { AxiosInstance, Method, AxiosResponse, AxiosRequestConfig } from 'axios';
|
||||
import {
|
||||
AxiosInstance,
|
||||
Method,
|
||||
AxiosResponse,
|
||||
AxiosRequestConfig,
|
||||
AxiosHeaders,
|
||||
AxiosHeaderValue,
|
||||
} from 'axios';
|
||||
import { Logger } from '@kbn/core/server';
|
||||
import { getCustomAgents } from './get_custom_agents';
|
||||
import { ActionsConfigurationUtilities } from '../actions_config';
|
||||
|
@ -29,7 +36,7 @@ export const request = async <T = unknown>({
|
|||
method?: Method;
|
||||
data?: T;
|
||||
configurationUtilities: ActionsConfigurationUtilities;
|
||||
headers?: Record<string, string> | null;
|
||||
headers?: Record<string, AxiosHeaderValue>;
|
||||
sslOverrides?: SSLSettings;
|
||||
} & AxiosRequestConfig): Promise<AxiosResponse> => {
|
||||
const { httpAgent, httpsAgent } = getCustomAgents(
|
||||
|
@ -43,8 +50,7 @@ export const request = async <T = unknown>({
|
|||
return await axios(url, {
|
||||
...config,
|
||||
method,
|
||||
// Axios doesn't support `null` value for `headers` property.
|
||||
headers: headers ?? undefined,
|
||||
headers,
|
||||
data: data ?? {},
|
||||
// use httpAgent and httpsAgent and set axios proxy: false, to be able to handle fail on invalid certs
|
||||
httpAgent,
|
||||
|
@ -149,6 +155,10 @@ export const createAxiosResponse = (res: Partial<AxiosResponse>): AxiosResponse
|
|||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: { ['content-type']: 'application/json' },
|
||||
config: { method: 'GET', url: 'https://example.com' },
|
||||
config: {
|
||||
method: 'GET',
|
||||
url: 'https://example.com',
|
||||
headers: new AxiosHeaders(),
|
||||
},
|
||||
...res,
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import axios, { AxiosError, AxiosInstance, AxiosResponse } from 'axios';
|
||||
import axios, { AxiosError, AxiosHeaders, AxiosInstance, AxiosResponse } from 'axios';
|
||||
import { loggingSystemMock } from '@kbn/core/server/mocks';
|
||||
import { MockedLogger } from '@kbn/logging-mocks';
|
||||
import { actionsConfigMock } from '../actions_config.mock';
|
||||
|
@ -29,7 +29,7 @@ const requestMock = utils.request as jest.Mock;
|
|||
const createAxiosError = (): AxiosError => {
|
||||
const error = new Error() as AxiosError;
|
||||
error.isAxiosError = true;
|
||||
error.config = { method: 'get', url: 'https://example.com' };
|
||||
error.config = { method: 'get', url: 'https://example.com', headers: new AxiosHeaders() };
|
||||
error.response = {
|
||||
data: { errorMessage: 'An error occurred', errorCode: 500 },
|
||||
} as AxiosResponse;
|
||||
|
|
|
@ -8,7 +8,14 @@
|
|||
import { isPlainObject, isEmpty } from 'lodash';
|
||||
import { Type } from '@kbn/config-schema';
|
||||
import { Logger } from '@kbn/logging';
|
||||
import axios, { AxiosInstance, AxiosResponse, AxiosError, AxiosRequestHeaders } from 'axios';
|
||||
import axios, {
|
||||
AxiosInstance,
|
||||
AxiosResponse,
|
||||
AxiosError,
|
||||
AxiosRequestHeaders,
|
||||
AxiosHeaders,
|
||||
AxiosHeaderValue,
|
||||
} from 'axios';
|
||||
import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server';
|
||||
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
|
||||
import { finished } from 'stream/promises';
|
||||
|
@ -75,7 +82,7 @@ export abstract class SubActionConnector<Config, Secrets> {
|
|||
}
|
||||
}
|
||||
|
||||
private getHeaders(headers?: AxiosRequestHeaders) {
|
||||
private getHeaders(headers?: AxiosRequestHeaders): Record<string, AxiosHeaderValue> {
|
||||
return { ...headers, 'Content-Type': 'application/json' };
|
||||
}
|
||||
|
||||
|
@ -130,7 +137,7 @@ export abstract class SubActionConnector<Config, Secrets> {
|
|||
method,
|
||||
data: this.normalizeData(data),
|
||||
configurationUtilities: this.configurationUtilities,
|
||||
headers: this.getHeaders(headers),
|
||||
headers: this.getHeaders(headers as AxiosHeaders),
|
||||
});
|
||||
|
||||
this.validateResponse(responseSchema, res.data);
|
||||
|
@ -139,7 +146,7 @@ export abstract class SubActionConnector<Config, Secrets> {
|
|||
} catch (error) {
|
||||
if (isAxiosError(error)) {
|
||||
this.logger.debug(
|
||||
`Request to external service failed. Connector Id: ${this.connector.id}. Connector type: ${this.connector.type}. Method: ${error.config.method}. URL: ${error.config.url}`
|
||||
`Request to external service failed. Connector Id: ${this.connector.id}. Connector type: ${this.connector.type}. Method: ${error.config?.method}. URL: ${error.config?.url}`
|
||||
);
|
||||
|
||||
let responseBody = '';
|
||||
|
|
|
@ -84,7 +84,7 @@ init().catch((e) => {
|
|||
console.error(e.message);
|
||||
} else if (isAxiosError(e)) {
|
||||
console.error(
|
||||
`${e.config.method?.toUpperCase() || 'GET'} ${e.config.url} (Code: ${
|
||||
`${e.config?.method?.toUpperCase() || 'GET'} ${e.config?.url} (Code: ${
|
||||
e.response?.status
|
||||
})`
|
||||
);
|
||||
|
|
|
@ -31,17 +31,17 @@ export async function getKibanaVersion({
|
|||
switch (e.response?.status) {
|
||||
case 401:
|
||||
throw new AbortError(
|
||||
`Could not access Kibana with the provided credentials. Username: "${e.config.auth?.username}". Password: "${e.config.auth?.password}"`
|
||||
`Could not access Kibana with the provided credentials. Username: "${e.config?.auth?.username}". Password: "${e.config?.auth?.password}"`
|
||||
);
|
||||
|
||||
case 404:
|
||||
throw new AbortError(
|
||||
`Could not get version on ${e.config.url} (Code: 404)`
|
||||
`Could not get version on ${e.config?.url} (Code: 404)`
|
||||
);
|
||||
|
||||
default:
|
||||
throw new AbortError(
|
||||
`Cannot access Kibana on ${e.config.baseURL}. Please specify Kibana with: "--kibana-url <url>"`
|
||||
`Cannot access Kibana on ${e.config?.baseURL}. Please specify Kibana with: "--kibana-url <url>"`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ describe.each(packageInfos)('Chromium archive: %s/%s', (architecture, platform)
|
|||
|
||||
const originalAxios = axios.defaults.adapter;
|
||||
beforeAll(async () => {
|
||||
axios.defaults.adapter = require('axios/lib/adapters/http'); // allow Axios to send actual requests
|
||||
axios.defaults.adapter = 'http';
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -25,9 +25,9 @@ export class FormattedAxiosError extends Error {
|
|||
super(axiosError.message);
|
||||
|
||||
this.request = {
|
||||
method: axiosError.config.method ?? '?',
|
||||
url: axiosError.config.url ?? '?',
|
||||
data: axiosError.config.data ?? '',
|
||||
method: axiosError.config?.method ?? '?',
|
||||
url: axiosError.config?.url ?? '?',
|
||||
data: axiosError.config?.data ?? '',
|
||||
};
|
||||
|
||||
this.response = {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { AxiosInstance, AxiosResponse } from 'axios';
|
||||
import axios from 'axios';
|
||||
import axios, { AxiosHeaders } from 'axios';
|
||||
import type { Logger } from '@kbn/core/server';
|
||||
import type { TelemetryPluginStart, TelemetryPluginSetup } from '@kbn/telemetry-plugin/server';
|
||||
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';
|
||||
|
@ -71,7 +71,9 @@ export class PreviewTelemetryEventsSender implements ITelemetryEventsSender {
|
|||
status: 200,
|
||||
statusText: 'ok',
|
||||
headers: {},
|
||||
config: {},
|
||||
config: {
|
||||
headers: new AxiosHeaders(),
|
||||
},
|
||||
};
|
||||
return Promise.resolve(okResponse);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AxiosHeaders } from 'axios';
|
||||
import {
|
||||
getObjectValueByKeyAsString,
|
||||
stringifyObjValues,
|
||||
|
@ -60,6 +61,7 @@ describe('cases_webhook/utils', () => {
|
|||
config: {
|
||||
method: 'post',
|
||||
url: 'https://poster.com',
|
||||
headers: new AxiosHeaders({}),
|
||||
},
|
||||
};
|
||||
it('Throws error when missing content-type', () => {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
jest.mock('axios', () => ({
|
||||
create: jest.fn(),
|
||||
AxiosHeaders: jest.requireActual('axios').AxiosHeaders,
|
||||
}));
|
||||
|
||||
import axios from 'axios';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AxiosRequestHeaders, AxiosResponse, ResponseType } from 'axios';
|
||||
import { AxiosResponse, ResponseType } from 'axios';
|
||||
import { IncomingMessage } from 'http';
|
||||
import { OpenAiProviderType } from '../../../../common/gen_ai/constants';
|
||||
import {
|
||||
|
@ -77,7 +77,7 @@ export const getAxiosOptions = (
|
|||
provider: string,
|
||||
apiKey: string,
|
||||
stream: boolean
|
||||
): { headers: AxiosRequestHeaders; responseType?: ResponseType } => {
|
||||
): { headers: Record<string, string>; responseType?: ResponseType } => {
|
||||
const responseType = stream ? { responseType: 'stream' as ResponseType } : {};
|
||||
switch (provider) {
|
||||
case OpenAiProviderType.OpenAi:
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
import { fromNullable, Option, map, filter } from 'fp-ts/lib/Option';
|
||||
import { pipe } from 'fp-ts/lib/pipeable';
|
||||
|
||||
export function getRetryAfterIntervalFromHeaders(headers: Record<string, string>): Option<number> {
|
||||
export function getRetryAfterIntervalFromHeaders(headers: Record<string, unknown>): Option<number> {
|
||||
return pipe(
|
||||
fromNullable(headers['retry-after']),
|
||||
map((retryAfter) => parseInt(retryAfter, 10)),
|
||||
map((retryAfter) => parseInt(retryAfter as string, 10)),
|
||||
filter((retryAfter) => !isNaN(retryAfter))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ jest.mock('@kbn/actions-plugin/server/lib/get_oauth_jwt_access_token', () => ({
|
|||
|
||||
jest.mock('axios', () => ({
|
||||
create: jest.fn(),
|
||||
AxiosHeaders: jest.requireActual('axios').AxiosHeaders,
|
||||
}));
|
||||
const createAxiosInstanceMock = axios.create as jest.Mock;
|
||||
const axiosInstanceMock = {
|
||||
|
@ -226,7 +227,7 @@ describe('utils', () => {
|
|||
const mockRequestCallback = (axiosInstanceMock.interceptors.request.use as jest.Mock).mock
|
||||
.calls[0][0];
|
||||
expect(await mockRequestCallback({ headers: {} })).toEqual({
|
||||
headers: { Authorization: 'Bearer tokentokentoken' },
|
||||
headers: new axios.AxiosHeaders({ Authorization: 'Bearer tokentokentoken' }),
|
||||
});
|
||||
|
||||
expect(getOAuthJwtAccessToken as jest.Mock).toHaveBeenCalledWith({
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import axios, { AxiosHeaders, AxiosInstance, AxiosResponse } from 'axios';
|
||||
import { Logger } from '@kbn/core/server';
|
||||
import { addTimeZoneToDate, getErrorMessage } from '@kbn/actions-plugin/server/lib/axios_utils';
|
||||
import { ActionsConfigurationUtilities } from '@kbn/actions-plugin/server/actions_config';
|
||||
|
@ -112,7 +112,7 @@ export const getAxiosInstance = ({
|
|||
} else {
|
||||
axiosInstance = axios.create();
|
||||
axiosInstance.interceptors.request.use(
|
||||
async (axiosConfig: AxiosRequestConfig) => {
|
||||
async (axiosConfig) => {
|
||||
const accessToken = await getOAuthJwtAccessToken({
|
||||
connectorId,
|
||||
logger,
|
||||
|
@ -137,7 +137,10 @@ export const getAxiosInstance = ({
|
|||
if (!accessToken) {
|
||||
throw new Error(`Unable to retrieve access token for connectorId: ${connectorId}`);
|
||||
}
|
||||
axiosConfig.headers = { ...axiosConfig.headers, Authorization: accessToken };
|
||||
axiosConfig.headers = new AxiosHeaders({
|
||||
...axiosConfig.headers,
|
||||
Authorization: accessToken,
|
||||
});
|
||||
return axiosConfig;
|
||||
},
|
||||
(error) => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
import axios, { AxiosHeaders, AxiosResponse } from 'axios';
|
||||
import { Logger } from '@kbn/core/server';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ActionsConfigurationUtilities } from '@kbn/actions-plugin/server/actions_config';
|
||||
|
@ -147,7 +147,9 @@ export const createExternalService = (
|
|||
status: 0,
|
||||
statusText: '',
|
||||
headers: {},
|
||||
config: {},
|
||||
config: {
|
||||
headers: new AxiosHeaders({}),
|
||||
},
|
||||
};
|
||||
|
||||
while (numberOfFetch < RE_TRY) {
|
||||
|
|
|
@ -366,7 +366,6 @@ function retryResult(actionId: string, serviceMessage: string): ActionTypeExecut
|
|||
function retryResultSeconds(
|
||||
actionId: string,
|
||||
serviceMessage: string,
|
||||
|
||||
retryAfter: number
|
||||
): ActionTypeExecutorResult<void> {
|
||||
const retryEpoch = Date.now() + retryAfter * 1000;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import axios, { AxiosInstance, AxiosRequestHeaders } from 'axios';
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import type { Capabilities as UICapabilities } from '@kbn/core/types';
|
||||
import { format as formatUrl } from 'url';
|
||||
import util from 'util';
|
||||
|
@ -61,7 +61,7 @@ export class UICapabilitiesService {
|
|||
this.log.debug(
|
||||
`requesting ${spaceUrlPrefix}/api/core/capabilities to parse the uiCapabilities`
|
||||
);
|
||||
const requestHeaders: AxiosRequestHeaders = credentials
|
||||
const requestHeaders: Record<string, string> = credentials
|
||||
? {
|
||||
Authorization: `Basic ${Buffer.from(
|
||||
`${credentials.username}:${credentials.password}`
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -11291,14 +11291,6 @@ axios@^0.26.0:
|
|||
dependencies:
|
||||
follow-redirects "^1.14.8"
|
||||
|
||||
axios@^0.27.2:
|
||||
version "0.27.2"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
|
||||
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
|
||||
dependencies:
|
||||
follow-redirects "^1.14.9"
|
||||
form-data "^4.0.0"
|
||||
|
||||
axios@^1.3.4, axios@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
|
||||
|
@ -16705,7 +16697,7 @@ folktale@2.3.2:
|
|||
resolved "https://registry.yarnpkg.com/folktale/-/folktale-2.3.2.tgz#38231b039e5ef36989920cbf805bf6b227bf4fd4"
|
||||
integrity sha512-+8GbtQBwEqutP0v3uajDDoN64K2ehmHd0cjlghhxh0WpcfPzAIjPA03e1VvHlxL02FVGR0A6lwXsNQKn3H1RNQ==
|
||||
|
||||
follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.8, follow-redirects@^1.14.9, follow-redirects@^1.15.0:
|
||||
follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.8, follow-redirects@^1.15.0:
|
||||
version "1.15.2"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
|
||||
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue