Closed daviande closed 2 years ago
LGTM. Just for comparison in Express this is the module used to do this exact same thing: https://www.npmjs.com/package/ee-first
Not sure if there are any differences, but might be worth checking for: https://github.com/jshttp/on-finished/blob/master/index.js#L115
I think the only thing I can think of is the cleanup to remove the events which I don't see happening here. Ex: https://github.com/jonathanong/ee-first/blob/master/index.js#L60-L66
Since the res is GC'd I wouldn't expect it to be an issue, but most of the express code is pretty hardened even against the weirdest of cases, so often good to follow.
…onnection mid response