mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
add agent support (#1973)
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
const querystring = require('querystring');
|
||||
const snekfetch = require('snekfetch');
|
||||
const https = require('https');
|
||||
|
||||
if (https.Agent) var agent = new https.Agent({ keepAlive: true });
|
||||
|
||||
class APIRequest {
|
||||
constructor(rest, method, path, options) {
|
||||
@@ -20,7 +23,7 @@ class APIRequest {
|
||||
this.path += `?${queryString}`;
|
||||
}
|
||||
|
||||
const request = snekfetch[this.method](`${API}${this.path}`);
|
||||
const request = snekfetch[this.method](`${API}${this.path}`, { agent });
|
||||
|
||||
if (this.options.auth !== false) request.set('Authorization', this.rest.getAuth());
|
||||
if (this.options.reason) request.set('X-Audit-Log-Reason', encodeURIComponent(this.options.reason));
|
||||
|
||||
Reference in New Issue
Block a user