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:
app.response.getHeader = (name) => {
return null;
};`
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: