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