Update APIRequest.js

Fix proxy-agent to version 5
This commit is contained in:
Ahmed 2023-11-30 14:11:13 +02:00 committed by GitHub
parent 48ebad7a1f
commit cca7d2ce66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,8 +35,8 @@ class APIRequest {
make(captchaKey = undefined, captchaRqtoken = undefined) { make(captchaKey = undefined, captchaRqtoken = undefined) {
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 ProxyAgent = require('proxy-agent');
agent = new proxy.ProxyAgent(this.client.options.proxy); agent = new 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;