forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.js
More file actions
31 lines (31 loc) · 1.2 KB
/
Copy pathnode.js
File metadata and controls
31 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.keepAlive = exports.proxy = void 0;
var superagent_1 = __importDefault(require("superagent"));
var agentkeepalive_1 = __importDefault(require("agentkeepalive"));
var proxyAgent_1 = __importDefault(require("../proxyAgent"));
var keepAliveAgent = null;
var keepAliveSecureAgent = null;
(0, proxyAgent_1.default)(superagent_1.default);
function proxy(superagentConstruct) {
return superagentConstruct.proxy(this._config.proxy);
}
exports.proxy = proxy;
function keepAlive(superagentConstruct) {
var agent = this._config.secure ? keepAliveSecureAgent : keepAliveAgent;
if (agent === null) {
var AgentClass = this._config.secure ? agentkeepalive_1.default.HttpsAgent : agentkeepalive_1.default;
agent = new AgentClass(this._config.keepAliveSettings);
if (this._config.secure) {
keepAliveSecureAgent = agent;
}
else {
keepAliveAgent = agent;
}
}
return superagentConstruct.agent(agent);
}
exports.keepAlive = keepAlive;