mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Merge pull request #1961 from lts20050703/gh-1939
Fix TypeError: Request with GET/HEAD method cannot have body
This commit is contained in:
@@ -23,10 +23,10 @@ export async function runMethod<T = any>(
|
||||
// For proxies we don't need to do any of the legwork so we just forward the request
|
||||
if (!url.startsWith(`${BASE_URL}/v${API_VERSION}`) && !url.startsWith(IMAGE_BASE_URL)) {
|
||||
const result = await fetch(url, {
|
||||
body: JSON.stringify(body || {}),
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
headers: {
|
||||
"Authorization": rest.secretKey,
|
||||
"Content-Type": "application/json"
|
||||
Authorization: rest.secretKey,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
method: method.toUpperCase(),
|
||||
}).catch((error) => {
|
||||
@@ -36,7 +36,7 @@ export async function runMethod<T = any>(
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
errorStack.message = result.statusText as Error['message'];
|
||||
errorStack.message = result.statusText as Error["message"];
|
||||
console.error(`Error: ${errorStack.message}`);
|
||||
throw errorStack;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user