Archived
0
0
Fork 0

fix: headers not working

This commit is contained in:
Daryl Ronningen 2021-07-06 14:58:29 -05:00
parent 7fa5ea6762
commit ba43c954fd
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
2 changed files with 3 additions and 3 deletions

View file

@ -25,7 +25,7 @@ export class ApiHandler {
}
public async makeRequest<T>(options: IMakeRequestOptions): Promise<T> {
const headers: Headers = new Headers();
const headers: Map<string, string> = new Map();
if (options.headers) for (const prop in options.headers) headers.set(prop, options.headers[prop]!);
@ -48,7 +48,7 @@ export class ApiHandler {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const res = await fetch(`${this.baseApiUrl}${options.path}`, { method: options.method, headers, signal: controller.signal, body });
const res = await fetch(`${this.baseApiUrl}${options.path}`, { method: options.method, headers: new Headers(headers), signal: controller.signal, body });
// TODO: handle Ratelimits

View file

@ -22,7 +22,7 @@ export interface IMakeRequestOptions {
body?: unknown;
headers?: Record<string, undefined>;
headers?: Record<string, string>;
method: ApiMethods;