mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-05 23:16:57 -06:00
Pass JSON schema validation error through response
This commit is contained in:
@@ -66,8 +66,9 @@ export default async function handler(
|
||||
|
||||
try {
|
||||
// Verify JSON body
|
||||
const { success, data } = requestSchema.safeParse(req.body);
|
||||
if (!success) return res.status(400).json({ message: "Invalid JSON body" });
|
||||
const { success, data, error } = requestSchema.safeParse(req.body);
|
||||
if (!success)
|
||||
return res.status(400).json({ message: "Invalid JSON body", error });
|
||||
|
||||
// Get URLs
|
||||
const urls = await getURLs(data.type, data.keys[0]!, data.payload);
|
||||
|
||||
Reference in New Issue
Block a user