mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user