GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http: replace finish() callback with arrow function · nodejs/node@e7b8400

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _http_outgoing.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_http_outgoing.js‎

Copy file name to clipboardExpand all lines: lib/_http_outgoing.js
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,6 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) {
546546
return false;
547547
}
548548

549-
var self = this;
550-
function finish() {
551-
self.emit('finish');
552-
}
553-
554-
if (typeof callback === 'function')
555-
this.once('finish', callback);
556-
557549
if (!this._header) {
558550
if (data) {
559551
if (typeof data === 'string')
@@ -581,6 +573,13 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) {
581573
this.write(data, encoding);
582574
}
583575

576+
if (typeof callback === 'function')
577+
this.once('finish', callback);
578+
579+
const finish = () => {
580+
this.emit('finish');
581+
};
582+
584583
if (this._hasBody && this.chunkedEncoding) {
585584
ret = this._send('0\r\n' + this._trailer + '\r\n', 'binary', finish);
586585
} else {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.