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 <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
cjihrig 2019-05-30 14:12:09 -04:00
parent 2983eaca84
commit f86100caf3
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -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] || '<pending>',
closed: this.closed,