Subscribe to res 'finish' event instead of redefining res 'end()' event #2

Open
andreypopp opened this Issue May 17, 2013 · 5 comments

Comments

Projects
None yet
3 participants

It's better to subscribe to an finish event on res instead of monkey-patching its end() method.

Owner

chilts commented May 17, 2013

I just copied what connect-session does. In some ways I don't mind how it does it and it kinda makes sense to me. It's just middleware that needs to run on the way out of the middleware stack rather than something orthogonal to it as you're proposing.

So, I'm not sure what to do here. Unless there are +1's I'll probably leave it. An example patch would be welcome so I can see how you'd do it. :)

Cheers,
Andy

It seems that connect-session was implemented before the response became a stream and even streams were introduced into the node's stdlib. But you are probably right — there's no point to fix things which are not broken.

Related connect PRs aren't yet accepted — senchalabs/connect#552

@chilts Did you refactor the code with this? Cheers

Owner

chilts commented Jan 7, 2017

Hi @dcworldwide - hmm, I can't quite remember since it was so long ago, however, I'm almost certain I didn't do anything. Does this issue still exist? Does anyone actually use this package? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment