From cb60fb872ac404b60d692fa0ce667074066ada08 Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Mon, 14 Oct 2013 22:40:02 -0700 Subject: [PATCH] only listen to stream errors if not already --- lib/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index 9d2f11b..fc01474 100644 --- a/lib/application.js +++ b/lib/application.js @@ -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); }