diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2016-11-21 13:50:02 -0800 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2016-12-12 08:15:36 -0800 |
commit | d4050b38d6bc42982ddc91571933d284c587e698 (patch) | |
tree | cdd26e424923d10488d16ba2ba51133817e58111 /test/parallel/test-tls-no-cert-required.js | |
parent | c3839f7ed47a4f09fe67fb5a1905a209249c0b9c (diff) | |
download | android-node-v8-d4050b38d6bc42982ddc91571933d284c587e698.tar.gz android-node-v8-d4050b38d6bc42982ddc91571933d284c587e698.tar.bz2 android-node-v8-d4050b38d6bc42982ddc91571933d284c587e698.zip |
tls: document and test option-less createServer
Either the options or the listener argument to tls.createServer() was
optional, but not both. This makes no sense, so align the argument
checking and documentation with net.createServer(), which accepts the
same option sequence, and which tls.createServer() is modelled on.
PR-URL: https://github.com/nodejs/node/pull/9800
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/parallel/test-tls-no-cert-required.js')
-rw-r--r-- | test/parallel/test-tls-no-cert-required.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index de723e73e8..8d907d9f8a 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -1,4 +1,5 @@ 'use strict'; +var assert = require('assert'); var common = require('../common'); if (!common.hasCrypto) { @@ -10,6 +11,20 @@ var tls = require('tls'); // Omitting the cert or pfx option to tls.createServer() should not throw. // AECDH-NULL-SHA is a no-authentication/no-encryption cipher and hence // doesn't need a certificate. -tls.createServer({ ciphers: 'AECDH-NULL-SHA' }).listen(0, function() { +tls.createServer({ ciphers: 'AECDH-NULL-SHA' }) + .listen(0, common.mustCall(close)); + +tls.createServer(assert.fail) + .listen(0, common.mustCall(close)); + +tls.createServer({}) + .listen(0, common.mustCall(close)); + +assert.throws(() => tls.createServer('this is not valid'), TypeError); + +tls.createServer() + .listen(0, common.mustCall(close)); + +function close() { this.close(); -}); +} |