Skip to content
Browse files

fixed issue #29

  • Loading branch information...
1 parent 426d412 commit 21ebb9e494d1881d1c9e45cd4c829f0774531d57 @impronunciable committed
Showing with 5 additions and 10 deletions.
  1. +5 −10 lib/tuiter.js
View
15 lib/tuiter.js
@@ -143,25 +143,20 @@ Tuiter.prototype.handleStream = function(req, endpoint, params, callback) {
var args = stream.args = arguments;
stream.emitAPIEvents();
stream.autoReconnect();
-
- req.pipe(stream);
- req.req.on('response', function(res){
- res.setEncoding('utf8');
- });
-
+
+ req.pipe(stream);
callback(stream);
stream.on('end', function(){
- if(stream.res) stream.res.removeAllListeners('end');
stream.end();
req = stream = null;
});
stream.on('reconnect', function(new_args){
params = new_args || params;
- if(stream.res) stream.res.removeAllListeners('end');
- req = stream = null;
- APIRequest.call(self, endpoint, params, callback);
+ stream.emit('end');
+ preProcess(params);
+ APIRequest.call(self, endpoint, params, callback);
});
};

0 comments on commit 21ebb9e

Please sign in to comment.
Something went wrong with that request. Please try again.