blob: 3471e46fdf4ca45705947ec29ddd9283cbe8407a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
'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.rstStream('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();
})
);
|