Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ exports.connect = function connect(...args) {
if (!options.keepAlive)
options.singleUse = true;

assert(typeof options.checkServerIdentity === 'function');
validateFunction(options.checkServerIdentity, 'options.checkServerIdentity');
assert(typeof options.minDHSize === 'number',
'options.minDHSize is not a number: ' + options.minDHSize);
assert(options.minDHSize > 0,
Expand Down
9 changes: 9 additions & 0 deletions test/parallel/test-tls-basic-validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,12 @@ assert.throws(() => { tls.createSecureContext({ maxVersion: 'fhqwhgads' }); },
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
name: 'TypeError'
});

[undefined, null, 1, true].forEach((value) => {
assert.throws(() => {
tls.connect({ checkServerIdentity: value });
}, {
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError',
});
});