-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add res.json(...) support - /w work around #39
Comments
If you wish the create a fix, I will review and merge it. |
Facing same problem due to undefined content-type. I tried to add a content-type to the headers in createRes but that didn't work either. Also I'm having a problem where the IP cannot be passed to the other middleware that I'm calling even though I have passed in {ip:...} in the options of runMiddleware.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Almost all of my controllers return res.json(...).
run-middleware does not appear to correctly support this.
In express/lib/response.js it tries to see if Content-Type is set as a header, eventually through the getHeader(...) call.
getHeader is implemented a little poorly, expecting "this[kOutHeaders]" to equal null, but instead it is undefined.
That means all res.json(...) calls will fail. I haven't looked at your code, but is your response not extending OutgoingMessage ?
As a workaround, after I did runMiddleware(app), I added this little gem:
The text was updated successfully, but these errors were encountered: