Skip to content

Commit 16944cf

Browse files
committed
lib: .end() error fixed
1 parent 9acc0d6 commit 16944cf

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/_http_outgoing.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,12 +868,10 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
868868
if (this.socket) {
869869
this.socket.cork();
870870
}
871-
872-
if (this._byteCount !== this._contentLength) {
871+
if (this._contentLength && this._byteCount !== this._contentLength) {
873872
throw new ERR_CONTENT_LENGTH_MISMATCH(this._contentLength, this._byteCount);
874-
} else {
875-
write_(this, chunk, encoding, null, true);
876873
}
874+
write_(this, chunk, encoding, null, true);
877875
} else if (this.finished) {
878876
if (typeof callback === 'function') {
879877
if (!this.writableFinished) {

0 commit comments

Comments
 (0)