Fix event data check.

This commit is contained in:
Mike Cao 2022-12-12 20:46:43 -08:00
parent e4fe22233c
commit 4cc22fcc95
4 changed files with 8 additions and 10 deletions

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.');
}