The following seems like very awkward behavior to me:
res.end() is called, the res.writable boolean should be set to false as per the documentation:res.writable
A boolean that is true by default, but turns false after an 'error' occurred or end() / destroy() was called
However:
console.log(res.writable); //true
res.end();
console.log(res.writable); //true
Now, how do I check if the respons has already been sent? The req end event is emitted when the request ends, not when a response is sent. The res close event is never emitted, there is only a finish event but this one is not documented and therefore unsupported.