Skip to content

Commit

Permalink
test: expand http2 util test coverage for headers
Browse files Browse the repository at this point in the history
Expand existing test cases to hit some additional branches of
toHeaderObject and mapToHeaders.

PR-URL: nodejs/node#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>
  • Loading branch information
apapirovski authored and addaleax committed Sep 30, 2017
1 parent ea74b1a commit 0a60621
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/parallel/test-http2-cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const server = h2.createServer();

const setCookie = [
'a=b',
'c=d; Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly'
'c=d; Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly',
'e=f'
];

// we use the lower-level API here
Expand Down
6 changes: 6 additions & 0 deletions test/parallel/test-http2-util-headers-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,10 @@ const regex =
})(mapToHeaders({ [name]: 'abc' }));
});

common.expectsError({
code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS',
message: regex
})(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc'] }));

assert(!(mapToHeaders({ te: 'trailers' }) instanceof Error));
assert(!(mapToHeaders({ te: ['trailers'] }) instanceof Error));

0 comments on commit 0a60621

Please sign in to comment.