-
Is there a way to use the context get value inside of zValidator? |
Beta Was this translation helpful? Give feedback.
Answered by
EdamAme-x
Jun 1, 2024
Replies: 2 comments 15 replies
-
hi @shishamo. const route = app.post(
'/posts',
zValidator(
'form',
z.object({
body: z.string(),
}),
(data, c) => {
...
}
),
(c) => {
const validated = c.req.valid("form");
// ... use your validated data
}
) Let's try! |
Beta Was this translation helpful? Give feedback.
6 replies
-
Oh actually not... The const route = app.post(
'/posts',
zValidator(
'form',
z.object({
body: z.string(),
}),
async (data, c) => {
// make some async check stuff...
}
),
(c) => {
const validated = c.req.valid("form");
// ... use your validated data
}
) |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi @shishamo
resolved this problem by
honojs/middleware#552