fix: proxy is not a constructor (2)

#833 #656
This commit is contained in:
Elysia 2023-09-03 19:25:51 +07:00
parent c152c0a814
commit 12f96a579a

View File

@ -36,7 +36,7 @@ class APIRequest {
if (agent === null) { if (agent === null) {
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.ProxyAgent(this.client.options.proxy);
} else if (this.client.options.http.agent instanceof https.Agent) { } else if (this.client.options.http.agent instanceof https.Agent) {
agent = this.client.options.http.agent; agent = this.client.options.http.agent;
agent.keepAlive = true; agent.keepAlive = true;