mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
b30dca8d9e
PR-URL: https://github.com/nodejs/node/pull/28627 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
30 lines
814 B
JavaScript
30 lines
814 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
const h2 = require('http2');
|
|
const assert = require('assert');
|
|
|
|
|
|
const server = h2.createServer(common.mustCall(function(req, res) {
|
|
req.on('aborted', common.mustCall(function() {
|
|
assert.strictEqual(this.aborted, true);
|
|
assert.strictEqual(this.complete, true);
|
|
}));
|
|
assert.strictEqual(req.aborted, false);
|
|
assert.strictEqual(req.complete, false);
|
|
res.write('hello');
|
|
server.close();
|
|
}));
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
const url = `http://localhost:${server.address().port}`;
|
|
const client = h2.connect(url, common.mustCall(() => {
|
|
const request = client.request();
|
|
request.on('data', common.mustCall((chunk) => {
|
|
client.destroy();
|
|
}));
|
|
}));
|
|
}));
|