-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Express hangs when a controller method's return value evaluates as false #764
Comments
Express requests will hang when controller methods do not return a response or when return a NULL value is returned. inversify/InversifyJS#764
Hi there! This PR (inversify/inversify-express-utils#126) breaks piping data like
This is because the headers won't be set yet when returning from the function. There is obviously a workaround by writing the headers before returning, but I liked the previous method of just returning without a value. This also gives the error handler a chance to set the headers (when opening the filestream fails for instance). Is there a way we can reimplement this? On a sidenote; this was a breaking change, so I would have expected the version number to change to 6.0.0 instead of 5.2.1. |
There currently (since this PR) seems no way to not let Inversify handle the response. This is obviously a problem. If people really want the possibility to not return anything and still let Inversify handle the response, we need some way to flag that we want to override functionality. This can possibly be done in the decorator? Hopefully we can find a good solution to this, but currently this is broken (since it's not released as a breaking change) and there is no workaround. As such, I would opt for reverting this PR until we find a decent way to handle this situation. @remojansen please advise. |
Expected Behavior
Controller methods that do not return a value or return a NULL value should complete the same as if it returned a value that does not evaluate as false.
Current Behavior
When the controller method does not return a value, or it returns a value that evaluates as false, the method is forced to call response.send() in order to complete the request.
Possible Solution
Steps to Reproduce (for bugs)
Context
I converted some of our express Lambda handlers over to be controller based and found that when a method did not return a result or the result evaluated to false then the request would be timed out by the server process. To workaround the issue I am forced to wrap the result of each function to do the same evaluation and call
response.send()
if the evaluation is false.Your Environment
The text was updated successfully, but these errors were encountered: