fix: proxy request

This commit is contained in:
Elysia 2023-05-11 20:24:23 +07:00
parent 29bbd1df20
commit af43fc6901

View File

@ -32,6 +32,9 @@ class APIRequest {
if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) { if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) {
const proxy = require('proxy-agent'); const proxy = require('proxy-agent');
agent = new proxy(this.client.options.proxy); 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 { } else {
agent = new https.Agent({ ...this.client.options.http.agent, keepAlive: true }); agent = new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
} }