diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js index 3c9b35bb774960..dcc1355a3230fd 100644 --- a/lib/internal/http2/util.js +++ b/lib/internal/http2/util.js @@ -442,13 +442,13 @@ function mapToHeaders(map, let count = 0; const keys = ObjectKeys(map); const singles = new Set(); - let i; + let i, j; let isArray; let key; let value; let isSingleValueHeader; let err; - for (i = 0; i < keys.length; i++) { + for (i = 0; i < keys.length; ++i) { key = keys[i]; value = map[key]; if (value === undefined || key === '') @@ -488,8 +488,8 @@ function mapToHeaders(map, throw new ERR_HTTP2_INVALID_CONNECTION_HEADERS(key); } if (isArray) { - for (var k = 0; k < value.length; k++) { - const val = String(value[k]); + for (j = 0; j < value.length; ++j) { + const val = String(value[j]); ret += `${key}\0${val}\0`; } count += value.length;