diff --git a/src/rest/run_method.ts b/src/rest/run_method.ts index e39680aab..53ff1f34b 100644 --- a/src/rest/run_method.ts +++ b/src/rest/run_method.ts @@ -14,7 +14,12 @@ export async function runMethod( if (body) { body = loopObject( body as Record, - (value) => typeof value === "bigint" ? value.toString() : value, + (value) => + typeof value === "bigint" + ? value.toString() + : Array.isArray(value) + ? value.map((v) => typeof v === "bigint" ? v.toString() : v) + : value, `Running forEach loop in runMethod function for changing bigints to strings.`, ); } diff --git a/tests/util/loop_object.ts b/tests/util/loop_object.ts index 236f4738f..bc5c11d17 100644 --- a/tests/util/loop_object.ts +++ b/tests/util/loop_object.ts @@ -40,7 +40,12 @@ Deno.test({ fn() { const converted = loopObject( objWithBigints, - (value) => typeof value === "bigint" ? value.toString() : value, + (value) => + typeof value === "bigint" + ? value.toString() + : Array.isArray(value) + ? value.map((v) => typeof v === "bigint" ? v.toString() : v) + : value, `Running for loop in unit test function for changing bigints to strings.`, );