From 6a2a49642f8302e147c09df33edf2f1169c7af1d Mon Sep 17 00:00:00 2001 From: Marco Schuster Date: Fri, 12 Aug 2016 14:25:46 +0200 Subject: [PATCH] stream: do not double-emit request.end() In a webpack browser environment, some clean-up process will lead to a double firing of the Request.prototype.end() function in http-browserify and cause an exception (because http-browserify will attempt to call setRequestHeaders, even though the request has been sent off already). This patch removes the double firing of end(). --- lib/twitter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/twitter.js b/lib/twitter.js index f92ce59a..dcbe74cd 100644 --- a/lib/twitter.js +++ b/lib/twitter.js @@ -240,7 +240,6 @@ Twitter.prototype.stream = function(method, params, callback) { request.on('error', function(error) { stream.emit('error', error); }); - request.end(); if (typeof callback === 'function') { callback(stream);