From cb682ed9048afc91e0f2d470cdaf1ed86924d4f2 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Fri, 15 Nov 2013 11:33:14 -0800 Subject: [PATCH] add body.close check for HEAD requests --- lib/application.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index 2763959..caa6956 100644 --- a/lib/application.js +++ b/lib/application.js @@ -210,7 +210,12 @@ function *respond(next){ // Stream body if (body instanceof Stream) { 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); }