diff options
Diffstat (limited to 'lib/http.js')
-rw-r--r-- | lib/http.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/http.js b/lib/http.js index 4aa8f5cb40f..3c8b60944c5 100644 --- a/lib/http.js +++ b/lib/http.js @@ -363,6 +363,11 @@ IncomingMessage.prototype._emitData = function(d) { IncomingMessage.prototype._emitEnd = function() { if (!this._endEmitted) { + if (this._decoder) { + var ret = this._decoder.end(); + if (ret) + this.emit('data', ret); + } this.emit('end'); } @@ -1859,6 +1864,11 @@ Client.prototype.request = function(method, path, headers) { // but it will get removed when we remove this legacy interface. c.on('socket', function(s) { s.on('end', function() { + if (self._decoder) { + var ret = self._decoder.end(); + if (ret) + self.emit('data', ret); + } self.emit('end'); }); }); |