Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions test/parallel/test-https-agent-getname.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

require('../common');
var assert = require('assert');
var https = require('https');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should use const

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


var agent = new https.Agent();

// empty options
assert.strictEqual(
agent.getName({}),
'localhost:::::::::'
);

// pass all options arguments
var options = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be const also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
Also modified the port from 80 to 443, though it makes no difference to the test.

host: '0.0.0.0',
port: 80,
localAddress: '192.168.1.1',
ca: 'ca',
cert: 'cert',
ciphers: 'ciphers',
key: 'key',
pfx: 'pfx',
rejectUnauthorized: false,
servername: 'localhost',
};

assert.strictEqual(
agent.getName(options),
'0.0.0.0:80:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost'
);