From 34104c9af354eef0473193f2257c20b90c5255bc Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Thu, 19 Dec 2013 21:14:44 -0800 Subject: [PATCH] refactor: allow any streams with .pipe method --- lib/application.js | 2 +- lib/response.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/application.js b/lib/application.js index c59a089..1ef6eef 100644 --- a/lib/application.js +++ b/lib/application.js @@ -215,7 +215,7 @@ function *respond(next){ } // Stream body - if (body instanceof Stream) { + if ('function' == typeof body.pipe) { if (!~body.listeners('error').indexOf(this.onerror)) body.on('error', this.onerror); if (head) { diff --git a/lib/response.js b/lib/response.js index a3ea91b..01be800 100644 --- a/lib/response.js +++ b/lib/response.js @@ -133,7 +133,7 @@ module.exports = { } // stream - if (val instanceof Stream) { + if ('function' == typeof val.pipe) { if (setType) this.type = 'bin'; return; }