Skip to content

Commit

Permalink
fix: passing body instead of parsedBody to schema validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierniki committed Sep 5, 2023
1 parent c9d2cf2 commit 738c058
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/api/algolia-webhook/validateBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const validateBody =
try {
const hasBody = hasParsedBody(req)

const parseResult = schema.safeParse(hasBody ? req.body : await req.json())
const parseResult = schema.safeParse(hasBody ? req.parsedBody : await req.json())
if (!parseResult.success) throw new HttpError("BadRequest", 400)

const reqWithBody: NextRequestWithValidBody<T> = Object.assign(req, { validBody: parseResult.data })
Expand Down

0 comments on commit 738c058

Please sign in to comment.