feat(APIRequest): support setting global headers in HTTPOptions (#5586)

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
Advaith
2021-05-10 01:56:56 -07:00
committed by GitHub
parent 1398431bca
commit 135abccd9c
3 changed files with 3 additions and 1 deletions

View File

@@ -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);