You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define a route with a validator schema (I'm using the example in the docs)
constroute=app.post('/posts',zValidator('form',z.object({body: z.string(),})),(c)=>{constvalidated=c.req.valid('form')// ... use your validated data})
Call endpoint with form data matching expecting shape.
What is the expected behavior?
c.req.valid('form') to parse the form data.
What do you see instead?
A validation error is thrown. Adding logs inside validator.js (in my node_modules) shows that the validator function is receiving an empty object. It seems that the multipart regex test fails so an empty object is returned. In my case, it fails because the Content-Type header does not have a space after the semi-colon (multipart/form-data;boundary=2b6246d41cda0544685d0b416bddc327) like the regex is expecting.
Additional information
This used to work fine, not clue what it is in my stack that has removed the space in the Content-Type header.
The text was updated successfully, but these errors were encountered:
What version of Hono are you using?
4.5.5
What runtime/platform is your app running on?
Cloudflare Workers
What steps can reproduce the bug?
What is the expected behavior?
c.req.valid('form')
to parse the form data.What do you see instead?
A validation error is thrown. Adding logs inside
validator.js
(in mynode_modules
) shows that thevalidator
function is receiving an empty object. It seems that the multipart regex test fails so an empty object is returned. In my case, it fails because theContent-Type
header does not have a space after the semi-colon (multipart/form-data;boundary=2b6246d41cda0544685d0b416bddc327
) like the regex is expecting.Additional information
This used to work fine, not clue what it is in my stack that has removed the space in the
Content-Type
header.The text was updated successfully, but these errors were encountered: