Closed SuperOleg39 closed 2 years ago
res.end should block middleware execution
test case are broken with this changes.
Is this case are really important?
Thanks and good spot! I'm not sure what is the setup for your express app, however how things are wired here have worked for some people (including myself).
Could you make the hook configurable, document the new option in the README, and add some tests? Thanks!
Yes, add tests and troubleshooting section)
Looks like I added unstable tests?
Doesn't look like it, things are passing on master
Nice, thanks!
After integrating fastify, POST requests to my application stopped working. The problem is somewhere in the depths of
body-parser
library for express. If parsing for body from this library works, request hangs, and fastify when calling next inonRequest
doesn't reach routing, request just hangs.We're not the only ones who are like this - https://github.com/fastify/fastify-express/issues/73#issuecomment-1067022626
To solve this problem, we can reject
body-parser
andcookie-parser
as well. To maintain backward compatibility, we can use already prepared parsing result fromfastify-cookie
andfastify-formbody
, put it intoreq.raw.cookies
andreq.raw.body
respectively. Then we need to move the express call to thepreHandler
hook, since we don't have the parsing results ready before that.