Eomm / fastify-raw-body

Request raw body
MIT License
44 stars 10 forks source link

first impl #1

Closed Eomm closed 4 years ago

Eomm commented 4 years ago

Doubt:

right now if a client send hello and the user set an instance hook:

app.addHook('preParsing', function (req, reply, payload, done) {... that changes hello to goodbye, the request.rawBody will be equals to goodbye.

I think that there is not an easy way to get hello since the application hook is not listed in the onRoute hook. I can manage the order of route's hook only.

Is this "not a problem"? Since the preParsing could be used to run decompression.


Edit: found how to get the body before any preParsing change it: add runFirst option

TODO

Closes https://github.com/fastify/fastify/issues/707