mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
37f1e4bf4f
PR-URL: https://github.com/nodejs/node/pull/44820 Fixes: https://github.com/nodejs/node/issues/44816 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) common.skip('missing crypto');
|
|
|
|
const assert = require('node:assert');
|
|
const http2 = require('node:http2');
|
|
const debug = require('node:util').debuglog('test');
|
|
|
|
const testResBody = 'response content';
|
|
|
|
{
|
|
// Invalid link header value
|
|
|
|
const server = http2.createServer();
|
|
|
|
server.on('request', common.mustCall((req, res) => {
|
|
debug('Server sending early hints...');
|
|
res.writeEarlyHints({ link: BigInt(100) });
|
|
|
|
debug('Server sending full response...');
|
|
res.end(testResBody);
|
|
}));
|
|
|
|
server.listen(0);
|
|
|
|
server.on('listening', common.mustCall(() => {
|
|
const client = http2.connect(`http://localhost:${server.address().port}`);
|
|
const req = client.request();
|
|
|
|
debug('Client sending request...');
|
|
|
|
req.on('headers', common.mustNotCall());
|
|
|
|
process.on('uncaughtException', (err) => {
|
|
debug(`Caught an exception: ${JSON.stringify(err)}`);
|
|
if (err.name === 'AssertionError') throw err;
|
|
assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE');
|
|
process.exit(0);
|
|
});
|
|
}));
|
|
}
|