fastify-raw-body
fastify-raw-body copied to clipboard
Support for blob/non-json requests
From what I can tell, this module allows you to access the raw body of the request as a Buffer, but there is no way to disable still parsing it as JSON. I would like to use this to access the raw binary of the request, which would require--
- not parsing the body as JSON
- associating
*content type (excludingapplication/json) with the raw body parser
I actually got this working without the library:
app.addContentTypeParser('*', { parseAs: 'buffer' }, (req, body, done) => {
return Buffer.isBuffer(body)
? done(null, body)
: done(new Error('Invalid body'))
})
Reopening as it seems a good use case