node/test/parallel/test-http2-socket-proxy-handler-for-has.js
Antoine du Hamel 2c1b9f506a
test: remove unnecessary noop function args to mustCall()
RefsL https://github.com/nodejs/node/pull/45027

PR-URL: https://github.com/nodejs/node/pull/45047
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
2022-10-20 13:13:32 +00:00

39 lines
1.0 KiB
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const fixtures = require('../common/fixtures');
const assert = require('assert');
const http2 = require('http2');
const serverOptions = {
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
};
const server = http2.createSecureServer(serverOptions, common.mustCall(
(req, res) => {
const request = req;
assert.strictEqual(request.socket.encrypted, true);
assert.ok('encrypted' in request.socket);
res.end();
}
));
server.listen(common.mustCall(() => {
const port = server.address().port;
const client = http2.connect('https://localhost:' + port, {
ca: fixtures.readKey('agent1-cert.pem'),
rejectUnauthorized: false
});
const req = client.request({});
req.on('response', common.mustCall((headers, flags) => {
console.log(headers);
server.close(common.mustCall());
}));
req.on('end', common.mustCall(() => {
client.close();
}));
req.end();
}));