From af43fc6901319202decb92058ae86401aad65ba6 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 11 May 2023 20:24:23 +0700 Subject: [PATCH] fix: proxy request --- src/rest/APIRequest.js | 3 +++ 1 file changed, 3 insertions(+) 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 }); }