add body.close check for HEAD requests
This commit is contained in:
parent
27d1336af5
commit
cb682ed904
1 changed files with 6 additions and 1 deletions
|
@ -210,7 +210,12 @@ 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 body.close(), res.end();
|
|
||||||
|
if (head) {
|
||||||
|
if (body.close) body.close();
|
||||||
|
return res.end();
|
||||||
|
}
|
||||||
|
|
||||||
return body.pipe(res);
|
return body.pipe(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue