Skip to content

Commit 4153938

Browse files
trivikrMylesBorins
authored andcommitted
test: http2Stream redundant shutdown and single cb
PR-URL: #15612 Refs: #14985 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent a4a5bee commit 4153938

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Flags: --expose-http2
2+
'use strict';
3+
4+
const common = require('../common');
5+
if (!common.hasCrypto)
6+
common.skip('missing crypto');
7+
const assert = require('assert');
8+
const http2 = require('http2');
9+
10+
const server = http2.createServer();
11+
12+
// Test blank return when a stream.session.shutdown is called twice
13+
// Also tests stream.session.shutdown with just a callback function (no options)
14+
server.on('stream', common.mustCall((stream) => {
15+
stream.session.shutdown(common.mustCall(() => {
16+
assert.strictEqual(
17+
stream.session.shutdown(common.mustNotCall()),
18+
undefined
19+
);
20+
}));
21+
stream.session.shutdown(common.mustNotCall());
22+
}));
23+
24+
server.listen(0, common.mustCall(() => {
25+
const client = http2.connect(`http://localhost:${server.address().port}`);
26+
27+
const req = client.request();
28+
req.resume();
29+
req.on('end', common.mustCall(() => server.close()));
30+
}));

0 commit comments

Comments
 (0)