diff --git a/src/rest/APIRequest.js b/src/rest/APIRequest.js index d5e4ec183c3d..c4487bf2a708 100644 --- a/src/rest/APIRequest.js +++ b/src/rest/APIRequest.js @@ -33,7 +33,7 @@ class APIRequest { ? this.client.options.http.api : `${this.client.options.http.api}/v${this.client.options.http.version}`; const url = API + this.path; - let headers = {}; + let headers = { ...this.client.options.http.headers }; if (this.options.auth !== false) headers.Authorization = this.rest.getAuth(); if (this.options.reason) headers['X-Audit-Log-Reason'] = encodeURIComponent(this.options.reason); diff --git a/src/util/Constants.js b/src/util/Constants.js index ca905ddc1dab..9d7aead77721 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -80,6 +80,7 @@ exports.DefaultOptions = { * @property {string} [cdn='https://cdn.discordapp.com'] Base url of the CDN * @property {string} [invite='https://discord.gg'] Base url of invites * @property {string} [template='https://discord.new'] Base url of templates + * @property {Object} [headers] Additional headers to send for all API requests */ http: { version: 8, diff --git a/typings/index.d.ts b/typings/index.d.ts index 59ab672fcd1e..9275049eb7ef 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2999,6 +2999,7 @@ declare module 'discord.js' { cdn?: string; invite?: string; template?: string; + headers?: Record; } type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;