From 2788fd6b980860d51490f0cd0c59639e1b7f6140 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Sun, 10 Mar 2019 13:00:07 +0800 Subject: [PATCH] http: delay ret declaration in method _flushOutput PR-URL: https://github.com/nodejs/node/pull/26562 Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca --- lib/_http_outgoing.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index d6e830e3f35770..9d308525c6e681 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -791,13 +791,13 @@ OutgoingMessage.prototype._flush = function _flush() { }; OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) { - var ret; - var outputLength = this.outputData.length; + const outputLength = this.outputData.length; if (outputLength <= 0) - return ret; + return undefined; - var outputData = this.outputData; + const outputData = this.outputData; socket.cork(); + let ret; for (var i = 0; i < outputLength; i++) { const { data, encoding, callback } = outputData[i]; ret = socket.write(data, encoding, callback);