only listen to stream errors if not already

This commit is contained in:
Jonathan Ong 2013-10-14 22:40:02 -07:00
parent 1810977700
commit cb60fb872a

View file

@ -195,7 +195,7 @@ function respond(next){
// Stream body
if (body instanceof Stream) {
body.on('error', this.onerror.bind(this));
if (!~body.listeners('error').indexOf(this.onerror)) body.on('error', this.onerror);
if (head) return res.end();
return body.pipe(res);
}