diff --git a/rest/runMethod.ts b/rest/runMethod.ts index 3f9a0874e..99de072ea 100644 --- a/rest/runMethod.ts +++ b/rest/runMethod.ts @@ -46,12 +46,15 @@ export async function runMethod( ); } + 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, });