diff --git a/src/rest/APIRequest.js b/src/rest/APIRequest.js index 0a5faf1..eca6bc5 100644 --- a/src/rest/APIRequest.js +++ b/src/rest/APIRequest.js @@ -32,6 +32,9 @@ class APIRequest { if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) { const proxy = require('proxy-agent'); agent = new proxy(this.client.options.proxy); + } else if (this.client.options.http.agent instanceof https.Agent) { + agent = this.client.options.http.agent; + agent.keepAlive = true; } else { agent = new https.Agent({ ...this.client.options.http.agent, keepAlive: true }); }