diff --git a/README.md b/README.md index f415eb08..65edcf8e 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,9 @@ fastify.register(require('fastify-multipart'), { attachFieldsToBody: true }) fastify.post('/upload/files', async function (req, reply) { const uploadValue = await req.body.upload.toBuffer() // access files const fooValue = await req.body.foo.value // other fields + const body = Object.fromEntries( + Object.keys(req.body).map((key) => [key, req.body[key].value]) + ) // Request body in key-value pairs, like req.body in Express (Node 12+) }) ```