diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 2290af5d998..2c6cc25f49f 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2062,8 +2062,9 @@ class ClientHttp2Session extends Http2Session { const onConnect = reqAsync.bind( requestOnConnect.bind(stream, headersList, options)); if (this.connecting) { - if (this[kPendingRequestCalls] !== null) { - this[kPendingRequestCalls].push(onConnect); + const pendingCalls = this[kPendingRequestCalls]; + if (pendingCalls !== null) { + pendingCalls[pendingCalls.length] = onConnect; } else { this[kPendingRequestCalls] = [onConnect]; this.once('connect', () => { diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js index ab50ef48b15..4c29214d28e 100644 --- a/lib/internal/http2/util.js +++ b/lib/internal/http2/util.js @@ -817,7 +817,7 @@ function buildNgHeaderString(arrayOrMap, } else if (singles.includes(key)) { throw new ERR_HTTP2_HEADER_SINGLE_VALUE(key); } else { - singles.push(key); + singles[singles.length] = key; } } const flags = neverIndex.length !== 0 && neverIndex.includes(key) ?