Skip to content

Commit 409576e

Browse files
apapirovskijasnell
authored andcommitted
test: expand http2 util test coverage for headers
Expand existing test cases to hit some additional branches of toHeaderObject and mapToHeaders. PR-URL: #15493 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 0503c44 commit 409576e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

test/parallel/test-http2-cookies.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const server = h2.createServer();
1111

1212
const setCookie = [
1313
'a=b',
14-
'c=d; Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly'
14+
'c=d; Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly',
15+
'e=f'
1516
];
1617

1718
// we use the lower-level API here

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,10 @@ const regex =
261261
})(mapToHeaders({ [name]: 'abc' }));
262262
});
263263

264+
common.expectsError({
265+
code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS',
266+
message: regex
267+
})(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc'] }));
268+
264269
assert(!(mapToHeaders({ te: 'trailers' }) instanceof Error));
270+
assert(!(mapToHeaders({ te: ['trailers'] }) instanceof Error));

0 commit comments

Comments
 (0)