diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js index baa233e5b0..4610be7e4d 100644 --- a/lib/internal/http2/util.js +++ b/lib/internal/http2/util.js @@ -360,8 +360,7 @@ function isIllegalConnectionSpecificHeader(name, value) { case HTTP2_HEADER_TRANSFER_ENCODING: return true; case HTTP2_HEADER_TE: - const val = Array.isArray(value) ? value.join(', ') : value; - return val !== 'trailers'; + return value !== 'trailers'; default: return false; } diff --git a/test/parallel/test-http2-util-headers-list.js b/test/parallel/test-http2-util-headers-list.js index 0bc06bb727..1884a22894 100644 --- a/test/parallel/test-http2-util-headers-list.js +++ b/test/parallel/test-http2-util-headers-list.js @@ -266,5 +266,10 @@ common.expectsError({ message: regex })(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc'] })); +common.expectsError({ + code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS', + message: regex +})(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc', 'trailers'] })); + assert(!(mapToHeaders({ te: 'trailers' }) instanceof Error)); assert(!(mapToHeaders({ te: ['trailers'] }) instanceof Error));