test: http2Stream redundant shutdown and single cb
PR-URL: https://github.com/nodejs/node/pull/15612 Refs: https://github.com/nodejs/node/issues/14985 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
ccd3afc843
commit
27d8202db5
29
test/parallel/test-http2-server-shutdown-redundant.js
Normal file
29
test/parallel/test-http2-server-shutdown-redundant.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const common = require('../common');
|
||||||
|
if (!common.hasCrypto)
|
||||||
|
common.skip('missing crypto');
|
||||||
|
const assert = require('assert');
|
||||||
|
const http2 = require('http2');
|
||||||
|
|
||||||
|
const server = http2.createServer();
|
||||||
|
|
||||||
|
// Test blank return when a stream.session.shutdown is called twice
|
||||||
|
// Also tests stream.session.shutdown with just a callback function (no options)
|
||||||
|
server.on('stream', common.mustCall((stream) => {
|
||||||
|
stream.session.shutdown(common.mustCall(() => {
|
||||||
|
assert.strictEqual(
|
||||||
|
stream.session.shutdown(common.mustNotCall()),
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
stream.session.shutdown(common.mustNotCall());
|
||||||
|
}));
|
||||||
|
|
||||||
|
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()));
|
||||||
|
}));
|
Loading…
x
Reference in New Issue
Block a user