Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
http2: add failing writes with destroy test
  • Loading branch information
mafintosh authored and mcollina committed May 10, 2018
commit 2df7396e27b08cabf66ca01bfc9185736dadb480
30 changes: 30 additions & 0 deletions test/parallel/test-http2-many-writes-and-destroy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const http2 = require('http2');

{
const server = http2.createServer((req, res) => {
req.pipe(res);
});

server.listen(0, () => {
const url = `http://localhost:${server.address().port}`;
const client = http2.connect(url);
const req = client.request({ ':method': 'POST' });

for (let i = 0; i < 4000; i++) {
req.write(Buffer.alloc(6));
}

req.on('close', common.mustCall(() => {
console.log('(req onclose)');
server.close();
client.close();
}));

req.once('data', common.mustCall(() => req.destroy()));
});
}