fix stream leak on HEAD. Closes #91

This commit is contained in:
TJ Holowaychuk 2013-11-15 10:49:28 -08:00
parent f4b7f279ea
commit f3a6f6ae39

View file

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