mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
794 B
30 lines
794 B
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const http2 = require('http2');
|
|
|
|
const server = http2.createServer();
|
|
|
|
// Test that ERR_HTTP2_INVALID_SESSION is thrown when a stream is destroyed
|
|
// before calling stream.session.shutdown
|
|
server.on('stream', common.mustCall((stream) => {
|
|
stream.session.destroy();
|
|
common.expectsError(
|
|
() => stream.session.shutdown(),
|
|
{
|
|
type: Error,
|
|
code: 'ERR_HTTP2_INVALID_SESSION',
|
|
message: 'The session has been destroyed'
|
|
}
|
|
);
|
|
}));
|
|
|
|
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()));
|
|
}));
|
|
|