From bd857084de75815d0d60d4a7dd4897dfc9e6cdec Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 6 Aug 2019 15:30:06 +0200 Subject: http: add missing stream-like properties to OutgoingMessage PR-URL: https://github.com/nodejs/node/pull/29018 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Rich Trott --- lib/_http_outgoing.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib/_http_outgoing.js') diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index e10f068f32..9477a9b7f7 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -112,7 +112,7 @@ Object.setPrototypeOf(OutgoingMessage.prototype, Stream.prototype); Object.setPrototypeOf(OutgoingMessage, Stream); Object.defineProperty(OutgoingMessage.prototype, 'writableFinished', { - get: function() { + get() { return ( this.finished && this.outputSize === 0 && @@ -121,6 +121,24 @@ Object.defineProperty(OutgoingMessage.prototype, 'writableFinished', { } }); +Object.defineProperty(OutgoingMessage.prototype, 'writableObjectMode', { + get() { + return false; + } +}); + +Object.defineProperty(OutgoingMessage.prototype, 'writableLength', { + get() { + return this.outputSize + (this.socket ? this.socket.writableLength : 0); + } +}); + +Object.defineProperty(OutgoingMessage.prototype, 'writableHighWaterMark', { + get() { + return this.socket ? this.socket.writableHighWaterMark : HIGH_WATER_MARK; + } +}); + Object.defineProperty(OutgoingMessage.prototype, '_headers', { get: internalUtil.deprecate(function() { return this.getHeaders(); -- cgit v1.2.3