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
Description: After causing the request to crash by supplying undefined headers, the request is not properly closed and this causes a dangling handle that lasts for a few seconds.
Actual behavior
Expected behavior
The request should be ended, even if there are unexpected exceptions.
The current setup will use the end() syntax and when the error is caught, the application will hang for a few seconds and then exit.
If you uncomment the r.req.end() line inside the catch, the application will exit immediately.
If we comment out the first line inside the try block and uncomment the second line, we now are testing the promise based method. This also hangs before allowing the application to exit.
If we comment out the r.req.end() line inside the .catch() handler, then the application exits immediately.
Checklist
I have searched through GitHub issues for similar issues.
I have completely read through the README and documentation.
I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
The text was updated successfully, but these errors were encountered:
To make it even clearer, here are a few scenarios, each can be put into a js file and executed within a project folder that has superagent installed as a dependency:
Here, the library will throw an exception, the try/catch will catch and log it, and there WILL be a dangling request causing the application to hang for a moment before completing. 🕐
Also, note that the end method does not capture the error and pass it to the callback as expected which is why we needed a try/catch block. ❌
Here, the library will throw an exception, the try/catch will catch and log it, and there WILL NOT be a dangling request and the application will complete immediately. ✅
Here we are using the promise logic, it appears that the exception is rejected correctly. The application will still hang for a while before exiting and the dangling request will still be present. 🕐
Describe the bug
Node.js version: 18.20.4
OS version: MacOs Sequoia 15.2
Description: After causing the request to crash by supplying undefined headers, the request is not properly closed and this causes a dangling handle that lasts for a few seconds.
Actual behavior
Expected behavior
The request should be ended, even if there are unexpected exceptions.
Code to reproduce
This code snippet is a setup for two scenarios:
end()
syntax and when the error is caught, the application will hang for a few seconds and then exit.r.req.end()
line inside the catch, the application will exit immediately.try
block and uncomment the second line, we now are testing thepromise
based method. This also hangs before allowing the application to exit.r.req.end()
line inside the.catch()
handler, then the application exits immediately.Checklist
The text was updated successfully, but these errors were encountered: