Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: onFinish will not be triggered again when finished #35845

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
this.socket.cork();
}

if (chunk) {
write_(this, chunk, encoding, null, true);
} else if (this.finished) {
if (this.finished) {
if (typeof callback === 'function') {
if (!this.writableFinished) {
this.on('finish', callback);
Expand All @@ -819,6 +817,8 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
}
}
return this;
} else if (chunk) {
write_(this, chunk, encoding, null, true);
} else if (!this._header) {
this._contentLength = 0;
this._implicitHeader();
Expand Down