diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index 5593b89d5..b23d424c8 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -18,7 +18,7 @@ export async function runMethod( typeof value === "bigint" ? value.toString() : Array.isArray(value) - ? value.map((v) => typeof v === "bigint" ? v.toString() : v) + ? value.map((v) => (typeof v === "bigint" ? v.toString() : v)) : value, `Running forEach loop in runMethod function for changing bigints to strings.`, ); @@ -62,7 +62,11 @@ export async function runMethod( method, reject, respond: (data: { status: number; body?: string }) => - resolve(camelize(JSON.parse(data.body || "{}"))), + resolve( + data.status !== 204 + ? camelize(JSON.parse(data.body ?? "{}")) + : ((undefined as unknown) as T), + ), }, { bucketId,