1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) common.skip('missing crypto'); 5 6const assert = require('node:assert'); 7const http2 = require('node:http2'); 8const debug = require('node:util').debuglog('test'); 9 10const testResBody = 'response content'; 11 12{ 13 // Invalid link header value 14 15 const server = http2.createServer(); 16 17 server.on('request', common.mustCall((req, res) => { 18 debug('Server sending early hints...'); 19 res.writeEarlyHints({ link: BigInt(100) }); 20 21 debug('Server sending full response...'); 22 res.end(testResBody); 23 })); 24 25 server.listen(0); 26 27 server.on('listening', common.mustCall(() => { 28 const client = http2.connect(`http://localhost:${server.address().port}`); 29 const req = client.request(); 30 31 debug('Client sending request...'); 32 33 req.on('headers', common.mustNotCall()); 34 35 process.on('uncaughtException', (err) => { 36 debug(`Caught an exception: ${JSON.stringify(err)}`); 37 if (err.name === 'AssertionError') throw err; 38 assert.strictEqual(err.code, 'ERR_INVALID_ARG_VALUE'); 39 process.exit(0); 40 }); 41 })); 42} 43