mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/15766 Ref: https://github.com/nodejs/node/issues/14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>v9.x-staging
Trivikram Kamat
7 years ago
committed by
James M Snell
2 changed files with 56 additions and 35 deletions
@ -0,0 +1,43 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
if (!common.hasCrypto) |
|||
common.skip('missing crypto'); |
|||
const http2 = require('http2'); |
|||
|
|||
const server = http2.createServer(); |
|||
|
|||
server.on( |
|||
'stream', |
|||
common.mustCall((stream) => { |
|||
const invalidArgTypeError = (param, type) => ({ |
|||
type: TypeError, |
|||
code: 'ERR_INVALID_ARG_TYPE', |
|||
message: `The "${param}" argument must be of type ${type}` |
|||
}); |
|||
common.expectsError( |
|||
() => stream.session.priority(undefined, {}), |
|||
invalidArgTypeError('stream', 'Http2Stream') |
|||
); |
|||
common.expectsError( |
|||
() => stream.session.rstStream(undefined), |
|||
invalidArgTypeError('stream', 'Http2Stream') |
|||
); |
|||
common.expectsError( |
|||
() => stream.session.rstStream(stream, 'string'), |
|||
invalidArgTypeError('code', 'number') |
|||
); |
|||
stream.session.destroy(); |
|||
}) |
|||
); |
|||
|
|||
server.listen( |
|||
0, |
|||
common.mustCall(() => { |
|||
const client = http2.connect(`http://localhost:${server.address().port}`); |
|||
const req = client.request(); |
|||
req.resume(); |
|||
req.on('end', common.mustCall(() => server.close())); |
|||
req.end(); |
|||
}) |
|||
); |
Loading…
Reference in new issue