Skip to content

Commit 9a03c2a

Browse files
committed
test: http2 util passing array in te header
This adds a test case in which array with two values is passed to param value in isIllegalConnectionSpecificHeader Refs: nodejs#14985
1 parent ff747e3 commit 9a03c2a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/internal/http2/util.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ function isIllegalConnectionSpecificHeader(name, value) {
360360
case HTTP2_HEADER_TRANSFER_ENCODING:
361361
return true;
362362
case HTTP2_HEADER_TE:
363-
const val = Array.isArray(value) ? value.join(', ') : value;
364-
return val !== 'trailers';
363+
return value !== 'trailers';
365364
default:
366365
return false;
367366
}

test/parallel/test-http2-util-headers-list.js

+5
Original file line numberDiff line numberDiff line change
@@ -266,5 +266,10 @@ common.expectsError({
266266
message: regex
267267
})(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc'] }));
268268

269+
common.expectsError({
270+
code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS',
271+
message: regex
272+
})(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc', 'trailers'] }));
273+
269274
assert(!(mapToHeaders({ te: 'trailers' }) instanceof Error));
270275
assert(!(mapToHeaders({ te: ['trailers'] }) instanceof Error));

0 commit comments

Comments
 (0)