mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix(rest): Fix empty Content-Type header (#2537)
* fix(rest): Fix empty Content-Type header * Update runMethod.ts * Update runMethod.ts
This commit is contained in:
+7
-4
@@ -46,12 +46,15 @@ export async function runMethod<T = any>(
|
||||
);
|
||||
}
|
||||
|
||||
const headers: HeadersInit = {
|
||||
Authorization: rest.secretKey,
|
||||
};
|
||||
if (body) {
|
||||
headers["Content-Type"] = "application/json";
|
||||
}
|
||||
const result = await fetch(`${baseEndpoints.BASE_URL}${route}`, {
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
headers: {
|
||||
Authorization: rest.secretKey,
|
||||
"Content-Type": body ? "application/json" : undefined,
|
||||
},
|
||||
headers,
|
||||
method,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user