Replies: 1 comment
-
Closing. The request body was invalid. It should've been stringified array or every single item in form data seperately. Hence the [object Object] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey folks, I hope this is the right place to ask these sort of questions.
I'm trying to figure out how to read a file in request body as well as rest of the form data that's being send.
I started with creating multer middleware that works fine, but then reading the body in any form throws an error. In this case it's
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received [Object: null prototype]
. I'm assuming that's because my middleware already altered the request body, but I still don't know how to approach this.If i try to do it the other way round that fails as well but with a different error. I'm pretty new to h3, but I tried to google it, and couldn't find any help anywhere.
To give you some more details about this specific usecase. My client sends me form data with 4 properties: a csv file, a string, a string, and an object. I'm saving file with multer, and then I'd like to read all of the other properties. I'm definitely missing something, but I think I'm just so stuck that I can't think of anything else anymore.
One more thing. In case i use only middleware, and then try to access body of request
Then the strings are okayish, but the object is converted to string type with value "[object Object] like so:
Beta Was this translation helpful? Give feedback.
All reactions