diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index ddf742277a9..38facedce7b 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -336,6 +336,9 @@ OutgoingMessage.prototype.uncork = function() { const len = this[kChunkedLength]; const buf = this[kChunkedBuffer]; + this[kChunkedBuffer].length = 0; + this[kChunkedLength] = 0; + assert(this.chunkedEncoding); let callbacks; @@ -353,9 +356,6 @@ OutgoingMessage.prototype.uncork = function() { callback(err); } } : null); - - this[kChunkedBuffer].length = 0; - this[kChunkedLength] = 0; }; OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {