You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.15.0
Plugin version
No response
Node.js version
18.15.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
ArchLinux latest
Description
I was following this guide to listen to aborted requests on a particular route (it's important to me that I can do it on a particular route - I don't want the hook variant).
Personally, I don't like to have this guide as it never been a reliable way to detect what you needs.
It is something that should be ask in node/help or node/discussion instead of here.
Anyway, the problem is that when the body is consumed. No extra close event would fired.
You should check the property yourself instead of relying the close event.
Prerequisites
Fastify version
4.15.0
Plugin version
No response
Node.js version
18.15.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
ArchLinux latest
Description
I was following this guide to listen to aborted requests on a particular route (it's important to me that I can do it on a particular route - I don't want the hook variant).
https://www.fastify.io/docs/latest/Guides/Detecting-When-Clients-Abort/
When doing a POST request with a body, the
close
event gets called as soon as the incoming request is made.It works fine on GET requests, and POST requests without a body.
Steps to Reproduce
https://www.fastify.io/docs/latest/Guides/Detecting-When-Clients-Abort/
Follow this exact guide, but replace
app.get
withapp.post
and update the fetch call to call with aPOST
, and include a non-empty body. For example.Since Node 18 comes with
fetch
and other APIs built-in, no additional packages or polyfills needed.Expected Behavior
When doing a POST request, even if it contains a body, I want the event to fire normally.
The text was updated successfully, but these errors were encountered: