Merge pull request #925 from discordeno/fix-run-method-return-object-instead-of-undefined

fix: return undefined on 204 status
This commit is contained in:
ITOH
2021-05-11 19:03:03 +01:00
committed by GitHub
+6 -2
View File
@@ -18,7 +18,7 @@ export async function runMethod<T = any>(
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<T = any>(
method,
reject,
respond: (data: { status: number; body?: string }) =>
resolve(camelize<T>(JSON.parse(data.body || "{}"))),
resolve(
data.status !== 204
? camelize<T>(JSON.parse(data.body ?? "{}"))
: ((undefined as unknown) as T),
),
},
{
bucketId,