Browse Source

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>
canary-base
Anatoli Papirovski 7 years ago
committed by Ruben Bridgewater
parent
commit
d8a226673b
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 3
      test/parallel/test-http2-cookies.js
  2. 6
      test/parallel/test-http2-util-headers-list.js

3
test/parallel/test-http2-cookies.js

@ -11,7 +11,8 @@ const server = h2.createServer();
const setCookie = [ const setCookie = [
'a=b', '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 // we use the lower-level API here

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

@ -261,4 +261,10 @@ const regex =
})(mapToHeaders({ [name]: 'abc' })); })(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));
assert(!(mapToHeaders({ te: ['trailers'] }) instanceof Error));

Loading…
Cancel
Save