Fix event data check.

This commit is contained in:
Mike Cao committed 2022-12-12 20:46:43 -08:00
1 parent e4fe22233c
commit 4cc22fcc95
4 files changed
+8 -10

No files matched your search

+1 -3
View File
@@ -35,9 +35,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
let { url } = payload;
// Validate eventData is JSON
const valid = eventData && typeof eventData === 'object' && !Array.isArray(eventData);
if (!valid) {
if (eventData && !(typeof eventData === 'object' && !Array.isArray(eventData))) {
return badRequest(res, 'Event Data must be in the form of a JSON Object.');
}