forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnode.js
More file actions
30 lines (23 loc) · 710 Bytes
/
node.js
File metadata and controls
30 lines (23 loc) · 710 Bytes
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
/* @flow */
import superagent from 'superagent';
import superagentProxy from 'superagent-proxy';
import AgentKeepAlive from 'agentkeepalive';
superagentProxy(superagent);
export function proxy(superagentConstruct: superagent) {
return superagentConstruct.proxy(this._config.proxy);
}
export function keepAlive(superagentConstruct: superagent) {
let AgentClass = null;
let agent = null;
if (this._config.secure) {
AgentClass = AgentKeepAlive.HttpsAgent;
} else {
AgentClass = AgentKeepAlive;
}
if (this._config.keepAliveSettings) {
agent = new AgentClass(this._config.keepAliveSettings);
} else {
agent = new AgentClass();
}
return superagentConstruct.agent(agent);
}