Just trying the below in Sveltekit (3.44) but the console always outputs:
Got data FormData {}
The request is simply (made via Postman):
curl --request POST \ --url http://localhost:3000/todos.json \ --header 'Content-Type: multipart/form-data; boundary=---011000010111000001101001' \ --form test=hello
Code:src/routes/todos/index.json.ts
export const post: RequestHandler = async (request) => { const data = await request.request.formData(); console.log('Got data', data); return { status: 200, body: 'text' }}
Othen than destructuring and cleaning up this code - why is formData empty ?
NB When setting the data line to await request.request.text() I receive (which shows I am receiving data):
Got data --X-INSOMNIA-BOUNDARYContent-Disposition: form-data; name="test"hello--X-INSOMNIA-BOUNDARY--