Skip to content

Commit 0e17ec1

Browse files
authored
[dev-tool] remove axios (Azure#27922)
### Packages impacted by this PR `dev-tool` ### Describe the problem that is addressed by this PR Rather than pull in `axios` to make a few simple HTTP calls (downloading the test proxy and checking its status), I replaced it with `fetch` since that is now unflagged in Node. To test this change, I removed the locally cached test proxy before running the keyvault-keys tests.
1 parent 3cf4266 commit 0e17ec1

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/tools/dev-tool/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@rollup/plugin-multi-entry": "^6.0.1",
4949
"@rollup/plugin-node-resolve": "^15.2.3",
5050
"@rollup/plugin-inject": "^5.0.5",
51-
"axios": "^1.6.2",
5251
"concurrently": "^8.2.2",
5352
"chalk": "~4.1.1",
5453
"decompress": "^4.2.1",

common/tools/dev-tool/src/util/testProxyUtils.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { createPrinter } from "./printer";
66
import { ProjectInfo, resolveProject, resolveRoot } from "./resolveProject";
77
import fs from "fs-extra";
88
import path from "path";
9-
import axios from "axios";
109
import decompress from "decompress";
1110
import envPaths from "env-paths";
1211
import { promisify } from "util";
@@ -101,7 +100,8 @@ function getDownloadUrl(binary: TestProxyBinary, version: string): string {
101100

102101
async function downloadTestProxy(downloadLocation: string, downloadUrl: string): Promise<void> {
103102
log(`Downloading test proxy binary from ${downloadUrl}`);
104-
const { data } = await axios.get<ArrayBuffer>(downloadUrl, { responseType: "arraybuffer" });
103+
const response = await fetch(downloadUrl);
104+
const data = await response.arrayBuffer();
105105
log(`Extracting test proxy binary to ${downloadLocation}`);
106106
await decompress(Buffer.from(data), downloadLocation);
107107
}
@@ -278,7 +278,13 @@ export async function startTestProxy(): Promise<TestProxy> {
278278

279279
export async function isProxyToolActive(): Promise<boolean> {
280280
try {
281-
await axios.get(`http://localhost:${process.env.TEST_PROXY_HTTP_PORT ?? 5000}/info/available`);
281+
const response = await fetch(
282+
`http://localhost:${process.env.TEST_PROXY_HTTP_PORT ?? 5000}/info/available`
283+
);
284+
285+
if (!response.ok) {
286+
return false;
287+
}
282288

283289
log.info(
284290
`Proxy tool seems to be active at http://localhost:${

0 commit comments

Comments
 (0)