From 799aeca1347af825dc5e63914a612585532c9c6f Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 30 May 2019 14:12:09 -0400 Subject: [PATCH] http2: respect inspect() depth This commit causes Http2Stream and Http2Session to account for inspect() depth. PR-URL: https://github.com/nodejs/node/pull/27983 Fixes: https://github.com/nodejs/node/issues/27976 Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- lib/internal/http2/core.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 34d7fe4285b799..b1e5d4cef55392 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1073,6 +1073,9 @@ class Http2Session extends EventEmitter { } [kInspect](depth, opts) { + if (typeof depth === 'number' && depth < 0) + return this; + const obj = { type: this[kType], closed: this.closed, @@ -1649,6 +1652,9 @@ class Http2Stream extends Duplex { } [kInspect](depth, opts) { + if (typeof depth === 'number' && depth < 0) + return this; + const obj = { id: this[kID] || '', closed: this.closed,