fix: headers not working
This commit is contained in:
parent
7fa5ea6762
commit
ba43c954fd
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ export interface IMakeRequestOptions {
|
|||
|
||||
body?: unknown;
|
||||
|
||||
headers?: Record<string, undefined>;
|
||||
headers?: Record<string, string>;
|
||||
|
||||
method: ApiMethods;
|
||||
|
||||
|
|
Reference in a new issue