From f86100caf3b5b48ef7c3d67d7f258dd1cba8f9b4 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 e23be01fa42ce4..0351f55afc6b93 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1069,6 +1069,9 @@ class Http2Session extends EventEmitter { } [kInspect](depth, opts) { + if (typeof depth === 'number' && depth < 0) + return this; + const obj = { type: this[kType], closed: this.closed, @@ -1645,6 +1648,9 @@ class Http2Stream extends Duplex { } [kInspect](depth, opts) { + if (typeof depth === 'number' && depth < 0) + return this; + const obj = { id: this[kID] || '', closed: this.closed,