Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update axios to work correctly behind http proxy #162414

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Expand Up @@ -793,7 +793,7 @@
"antlr4ts": "^0.5.0-alpha.3",
"archiver": "^5.3.1",
"async": "^3.2.3",
"axios": "^0.27.2",
"axios": "^1.1.2",
mistic marked this conversation as resolved.
Show resolved Hide resolved
"base64-js": "^1.3.1",
"bitmap-sdf": "^1.0.3",
"blurhash": "^2.0.1",
Expand Down Expand Up @@ -1549,5 +1549,10 @@
"xml-crypto": "^3.0.1",
"xmlbuilder": "13.0.2",
"yargs": "^15.4.1"
},
"jest": {
"moduleNameMapper": {
"axios": "axios/dist/node/axios.cjs"
}
}
}
5 changes: 1 addition & 4 deletions packages/kbn-ci-stats-reporter/src/ci_stats_reporter.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions src/dev/build/lib/download.ts
Expand Up @@ -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) {
Expand Down Expand Up @@ -78,7 +74,7 @@ export async function downloadToDisk({
const response = await Axios.request({
url,
responseType: 'stream',
adapter: AxiosHttpAdapter,
adapter: 'http',
});

if (response.status !== 200) {
Expand Down Expand Up @@ -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,
});
Expand Down
10 changes: 1 addition & 9 deletions yarn.lock
Expand Up @@ -11048,14 +11048,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.1.2, axios@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
Expand Down Expand Up @@ -16322,7 +16314,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==
Expand Down