diff --git a/src/rest/runMethod.ts b/src/rest/runMethod.ts index 9a7c8801d..692e82b10 100644 --- a/src/rest/runMethod.ts +++ b/src/rest/runMethod.ts @@ -23,10 +23,10 @@ export async function runMethod( // 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( }); if (!result.ok) { - errorStack.message = result.statusText as Error['message']; + errorStack.message = result.statusText as Error["message"]; console.error(`Error: ${errorStack.message}`); throw errorStack; }