Skip to content

Commit

Permalink
test: http2 util passing array in te header
Browse files Browse the repository at this point in the history
This adds a test case in which array with two values is passed to
param value in isIllegalConnectionSpecificHeader

Refs: nodejs#14985
  • Loading branch information
trivikr committed Oct 17, 2017
1 parent ff747e3 commit 9a03c2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/internal/http2/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions test/parallel/test-http2-util-headers-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

0 comments on commit 9a03c2a

Please sign in to comment.