-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Steps to reproduce
Every response that contains plain API data (not file download, binary, etc...), is ended twice.
- from
operationResults.sendBody - explicitly calling
.endon the response one line below
Current Behavior
On NodeJS versions >= 13.8.0 the internal NodeJS behavior of response handling has changed (see relevant NodeJS issue), leading to hanging requests. I have a local dev environment where a Loopback v3 API is run, contaning also the middleware for static-file serving. Every file request that happens to re-use a socket that was ended twice from the above mentioned lines, hangs.
Expected Behavior
The requests should complete successfully.
Versions prior to v13.8.0 have a response handling mechanism that is not affected by multiple .end on a socket instance. I believe this is also a bug in NodeJS, that is also I opened the issue there.
However, I also believe double ending the response is a bad practice, since res.json that is called from sendBodyJson terminates the response itself, without the need to explicitly .end the response one line below.
Additional information
linux x64 14.15.3
[email protected]
Related Issues
None