test: expand http2 util test coverage for headers

Expand existing test cases to hit some additional branches of
toHeaderObject and mapToHeaders.

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Anatoli Papirovski 2017-09-20 08:22:49 -04:00 committed by Ruben Bridgewater
parent d9cc105102
commit d8a226673b
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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));