mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: remove dead code in test-http2-misbehaving-multiplex
PR-URL: https://github.com/nodejs/node/pull/54860 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
e48df8d64b
commit
9db6327af3
@ -11,35 +11,18 @@ const h2 = require('http2');
|
|||||||
const net = require('net');
|
const net = require('net');
|
||||||
const { NghttpError } = require('internal/http2/util');
|
const { NghttpError } = require('internal/http2/util');
|
||||||
const h2test = require('../common/http2');
|
const h2test = require('../common/http2');
|
||||||
let client;
|
|
||||||
|
|
||||||
const server = h2.createServer();
|
const server = h2.createServer();
|
||||||
let gotFirstStreamId1;
|
|
||||||
server.on('stream', common.mustCall((stream) => {
|
server.on('stream', common.mustCall((stream) => {
|
||||||
stream.respond();
|
stream.respond();
|
||||||
stream.end('ok');
|
stream.end('ok');
|
||||||
|
|
||||||
// Http2Server should be fast enough to respond to and close
|
stream.on('error', common.expectsError({
|
||||||
// the first streams with ID 1 and ID 3 without errors.
|
code: 'ERR_HTTP2_ERROR',
|
||||||
|
constructor: NghttpError,
|
||||||
// Test for errors in 'close' event to ensure no errors on some streams.
|
message: 'Stream was already closed or invalid'
|
||||||
stream.on('error', () => {});
|
}));
|
||||||
stream.on('close', (err) => {
|
stream.on('close', common.mustCall());
|
||||||
if (stream.id === 1) {
|
|
||||||
if (gotFirstStreamId1) {
|
|
||||||
// We expect our outgoing frames to fail on Stream ID 1 the second time
|
|
||||||
// because a stream with ID 1 was already closed before.
|
|
||||||
common.expectsError({
|
|
||||||
constructor: NghttpError,
|
|
||||||
code: 'ERR_HTTP2_ERROR',
|
|
||||||
message: 'Stream was already closed or invalid'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gotFirstStreamId1 = true;
|
|
||||||
}
|
|
||||||
assert.strictEqual(err, undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Stream ID 5 should never reach the server
|
// Stream ID 5 should never reach the server
|
||||||
assert.notStrictEqual(stream.id, 5);
|
assert.notStrictEqual(stream.id, 5);
|
||||||
@ -62,7 +45,7 @@ const id3 = new h2test.HeadersFrame(3, h2test.kFakeRequestHeaders, 0, true);
|
|||||||
const id5 = new h2test.HeadersFrame(5, h2test.kFakeRequestHeaders, 0, true);
|
const id5 = new h2test.HeadersFrame(5, h2test.kFakeRequestHeaders, 0, true);
|
||||||
|
|
||||||
server.listen(0, () => {
|
server.listen(0, () => {
|
||||||
client = net.connect(server.address().port, () => {
|
const client = net.connect(server.address().port, () => {
|
||||||
client.write(h2test.kClientMagic, () => {
|
client.write(h2test.kClientMagic, () => {
|
||||||
client.write(settings.data, () => {
|
client.write(settings.data, () => {
|
||||||
client.write(settingsAck.data);
|
client.write(settingsAck.data);
|
||||||
|
Loading…
Reference in New Issue
Block a user