Open ericf opened 11 years ago
Also, I'm unsure that even the implementation in <= 0.2.1
would even work in Express 3.x since the handler function always calls next()
which will lead to a 404 since res.send()
was never called.
Oh, dang. Guess we should have a test for that case.
I'll have to do some digging to figure out when we know we're being used directly, vs in a route callback chain...
I think it's fine to add a new function to serve this feature which basically would have to manually call into the other middleware functions and can't rely on next()
.
Yeah, I have an angle on inspecting the req.route.callbacks
array, see if the current middleware is the end of the chain, and then just res.send(res.body)
instead of next()
. I fiddled with it a couple weeks ago (hence naming some of the anonymous functions returned as middleware), it's crazy what Express gives access to in the req
and res
objects.
Express middleware used via
app.use()
requires a function, this commit https://github.com/rgrove/combohandler/commit/bc842d9ec1370dcd54d734b90ea7b97dc3140ce7 madecombo.combine()
always return an array.