| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44bc638 commit e7b8400
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -546,14 +546,6 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) { | |||
| 546 | 546 | return false; | |
| 547 | 547 | } | |
| 548 | 548 | ||
| 549 | - var self = this; | ||
| 550 | - function finish() { | ||
| 551 | - self.emit('finish'); | ||
| 552 | - } | ||
| 553 | - | ||
| 554 | - if (typeof callback === 'function') | ||
| 555 | - this.once('finish', callback); | ||
| 556 | - | ||
| 557 | 549 | if (!this._header) { | |
| 558 | 550 | if (data) { | |
| 559 | 551 | if (typeof data === 'string') | |
@@ -581,6 +573,13 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) { | |||
| 581 | 573 | this.write(data, encoding); | |
| 582 | 574 | } | |
| 583 | 575 | ||
| 576 | + if (typeof callback === 'function') | ||
| 577 | + this.once('finish', callback); | ||
| 578 | + | ||
| 579 | + const finish = () => { | ||
| 580 | + this.emit('finish'); | ||
| 581 | + }; | ||
| 582 | + | ||
| 584 | 583 | if (this._hasBody && this.chunkedEncoding) { | |
| 585 | 584 | ret = this._send('0\r\n' + this._trailer + '\r\n', 'binary', finish); | |
| 586 | 585 | } else { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments