• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7const assert = require('assert');
8const https = require('https');
9
10const agent = new https.Agent();
11
12// empty options
13assert.strictEqual(
14  agent.getName({}),
15  'localhost::::::::::::::::::::::'
16);
17
18// Pass all options arguments
19const options = {
20  host: '0.0.0.0',
21  port: 443,
22  localAddress: '192.168.1.1',
23  ca: 'ca',
24  cert: 'cert',
25  clientCertEngine: 'dynamic',
26  ciphers: 'ciphers',
27  crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')],
28  dhparam: 'dhparam',
29  ecdhCurve: 'ecdhCurve',
30  honorCipherOrder: false,
31  key: 'key',
32  pfx: 'pfx',
33  rejectUnauthorized: false,
34  secureOptions: 0,
35  secureProtocol: 'secureProtocol',
36  servername: 'localhost',
37  sessionIdContext: 'sessionIdContext',
38  sigalgs: 'sigalgs',
39  privateKeyIdentifier: 'privateKeyIdentifier',
40  privateKeyEngine: 'privateKeyEngine',
41};
42
43assert.strictEqual(
44  agent.getName(options),
45  '0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' +
46    '::secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext:' +
47    '"sigalgs":privateKeyIdentifier:privateKeyEngine'
48);
49