From 4deac14cbe7e83363a85395838fa5ed6679262bc Mon Sep 17 00:00:00 2001 From: Denis DelGrosso Date: Tue, 25 Jul 2023 13:55:18 +0000 Subject: [PATCH] fix(deps): update https-proxy-agent to 7.0.1 and fix imports and tests --- package.json | 2 +- src/gaxios.ts | 3 ++- test/test.getch.ts | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9727a39..b7e3217 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ }, "dependencies": { "extend": "^3.0.2", - "https-proxy-agent": "^5.0.0", + "https-proxy-agent": "^7.0.1", "is-stream": "^2.0.0", "node-fetch": "^2.6.9" } diff --git a/src/gaxios.ts b/src/gaxios.ts index 9cb3f89..907b236 100644 --- a/src/gaxios.ts +++ b/src/gaxios.ts @@ -29,6 +29,7 @@ import { } from './common'; import {getRetryConfig} from './retry'; import {Stream} from 'stream'; +import {HttpsProxyAgent as httpsProxyAgent} from 'https-proxy-agent'; /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -69,7 +70,7 @@ function loadProxy() { process?.env?.HTTP_PROXY || process?.env?.http_proxy; if (proxy) { - HttpsProxyAgent = require('https-proxy-agent'); + HttpsProxyAgent = httpsProxyAgent; } return proxy; } diff --git a/test/test.getch.ts b/test/test.getch.ts index f20ee71..e877628 100644 --- a/test/test.getch.ts +++ b/test/test.getch.ts @@ -17,8 +17,7 @@ import sinon from 'sinon'; import stream from 'stream'; import {describe, it, afterEach} from 'mocha'; import fetch from 'node-fetch'; -// eslint-disable-next-line @typescript-eslint/no-var-requires -const HttpsProxyAgent = require('https-proxy-agent'); +import {HttpsProxyAgent} from 'https-proxy-agent'; import { Gaxios, GaxiosError,