Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit c873ba9

Browse files
Remove superagent-proxy dep completely and use proxy-agent directly
1 parent 46e4ec5 commit c873ba9

File tree

4 files changed

+7
-137
lines changed

4 files changed

+7
-137
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build:release": "tsc -p ./tsconfig-release.json && npm run content",
1414
"test": "npm run build && mocha --recursive bin/test",
1515
"test:debugger": "mocha --recursive --inspect-brk=0.0.0.0 bin/test",
16-
"content": "shx cp {plugin.xml,README.md,package.json,.npmignore} bin && cp src/utils/*.js bin/utils/"
16+
"content": "shx cp {plugin.xml,README.md,package.json,.npmignore} bin"
1717
},
1818
"repository": {
1919
"type": "git",

src/utils/request-manager.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import superagent = require("superagent");
2+
import { ProxyAgent } from "proxy-agent";
23
import { CodePushUnauthorizedError } from "../script/code-push-error"
34
import { CodePushError, Headers } from "../script/types";
45

5-
import superagent_setup from "./superagent-proxy.js";
6-
superagent_setup(superagent);
7-
86
interface JsonResponse {
97
headers: Headers;
108
body?: any;
@@ -52,7 +50,11 @@ class RequestManager {
5250
private makeApiRequest(method: string, endpoint: string, requestBody: string, expectResponseBody: boolean, contentType: string): Promise<JsonResponse> {
5351
return new Promise<any>((resolve, reject) => {
5452
var request: superagent.Request = (<any>superagent)[method](this._serverUrl + endpoint);
55-
if (this._proxy) (<any>request).proxy(this._proxy);
53+
54+
if (this._proxy) {
55+
(<superagent.SuperAgentRequest>request).agent(new ProxyAgent({ getProxyForUrl: () => this._proxy }))
56+
}
57+
5658
this.attachCredentials(request);
5759

5860
if (requestBody) {

src/utils/superagent-proxy.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/utils/superagent-proxy.js

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)