Skip to content

Commit

Permalink
Use proxy-agent instead of superagent-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
szaboopeeter committed Oct 1, 2023
1 parent 0c4cd0f commit 3a17d2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
3 changes: 1 addition & 2 deletions packages/@ionic/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
"lodash": "^4.17.5",
"open": "^7.0.4",
"os-name": "^4.0.0",
"proxy-agent": "^6.3.0",
"semver": "^7.1.1",
"split2": "^3.0.0",
"ssh-config": "^1.1.1",
"stream-combiner2": "^1.1.1",
"superagent": "^8.0.9",
"superagent-proxy": "^3.0.0",
"tar": "^6.0.1",
"tslib": "^2.0.1"
},
Expand All @@ -77,7 +77,6 @@
"@types/semver": "^7.1.0",
"@types/split2": "^2.1.6",
"@types/superagent": "4.1.3",
"@types/superagent-proxy": "^3.0.0",
"@types/tar": "^6.1.2",
"jest": "^26.4.2",
"jest-cli": "^26.0.1",
Expand Down
13 changes: 2 additions & 11 deletions packages/@ionic/cli/src/lib/utils/http.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { conform } from '@ionic/utils-array';
import { readFile } from '@ionic/utils-fs';
import * as Debug from 'debug';
import { ProxyAgent } from 'proxy-agent';

import { CreateRequestOptions, HttpMethod } from '../../definitions';

export type SuperAgentRequest = import('superagent').SuperAgentRequest;

const debug = Debug('ionic:lib:utils:http');

export const PROXY_ENVIRONMENT_VARIABLES: readonly string[] = ['IONIC_HTTP_PROXY', 'HTTPS_PROXY', 'HTTP_PROXY', 'PROXY', 'https_proxy', 'http_proxy', 'proxy'];

function getGlobalProxy(): { envvar: string; envval: string; } | undefined {
Expand Down Expand Up @@ -38,14 +36,7 @@ export async function createRequest(method: HttpMethod, url: string, { userAgent
.redirects(25);

if (proxy) {
const superagentProxy = await import('superagent-proxy');
superagentProxy(superagent);

if (req.proxy) {
req.proxy(proxy);
} else {
debug(`Cannot install proxy--req.proxy not defined`);
}
req.agent(new ProxyAgent({ getProxyForUrl: () => proxy as string }))
}

if (ssl) {
Expand Down

0 comments on commit 3a17d2a

Please sign in to comment.