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
Send only file is normal
Send only "name" field is normal
Send both "file" and "name" is normal
but when nothing in body it throw "Failed to parse body"
import{Elysia,t}from'elysia'constapp=newElysia()app.post('/',({ body })=>{console.log(body)return{ok: true}},{type: 'multipart/form-data',body: t.Object({file: t.Optional(t.File()),name: t.Optional(t.String())})})app.listen(5000,(server)=>{console.log(`> App is listening at: ${server.url.origin}`)})
What is the expected behavior?
body is {}
What do you see instead?
"Failed to parse body" in response
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
Yes
The text was updated successfully, but these errors were encountered:
misonomikadev
changed the title
Error from sending non-required file field multipart/form-data
Error from sending empty body multipart/form-data
Aug 15, 2024
What version of Elysia is running?
1.1.6
What platform is your computer?
Linux 6.5.0-45-generic x86_64 x86_64
What steps can reproduce the bug?
Send only file is normal
Send only "name" field is normal
Send both "file" and "name" is normal
but when nothing in body it throw "Failed to parse body"
What is the expected behavior?
body is {}
What do you see instead?
"Failed to parse body" in response
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?Yes
The text was updated successfully, but these errors were encountered: