create-servers
Advanced tools
Comparing version 3.0.0 to 3.0.1
# CHANGELOG | ||
## 3.0.1 | ||
- [#22] Return value compatibility. Do no return `null` valued keys. | ||
## 3.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -59,3 +59,5 @@ 'use strict'; | ||
const servers = { http, https }; | ||
const servers = {}; | ||
if (http) servers.http = http; | ||
if (https) servers.https = https; | ||
@@ -62,0 +64,0 @@ if (httpErr || httpsErr) { |
{ | ||
"name": "create-servers", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Create an http AND/OR an https server and call the same request handler.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,3 +47,3 @@ /* | ||
.once('close', reject) | ||
.once('error', reject) | ||
.once('error', reject); | ||
}); | ||
@@ -55,3 +55,3 @@ req.once('error', reject); | ||
test('only http', function (t) { | ||
t.plan(3); | ||
t.plan(5); | ||
createServers({ | ||
@@ -66,2 +66,4 @@ log: console.log, | ||
t.equals(typeof servers.http, 'object'); | ||
t.equals(servers.http instanceof Array, false); | ||
t.equals(servers.https, undefined); | ||
servers.http.close(); | ||
@@ -107,3 +109,3 @@ }); | ||
test('only https', function (t) { | ||
t.plan(3); | ||
t.plan(5); | ||
createServers({ | ||
@@ -122,2 +124,4 @@ log: console.log, | ||
t.equals(typeof servers.https, 'object'); | ||
t.equals(servers.https instanceof Array, false); | ||
t.equals(servers.http, undefined); | ||
servers.https.close(); | ||
@@ -157,3 +161,3 @@ }); | ||
cert: path.resolve(__dirname, 'fixtures', 'example-org-cert.pem'), | ||
key: path.resolve(__dirname, 'fixtures', 'example-org-key.pem') | ||
key: path.resolve(__dirname, 'fixtures', 'example-org-key.pem') | ||
}, | ||
@@ -191,3 +195,3 @@ handler: fend | ||
test('provides useful debug information', async function(t) { | ||
test('provides useful debug information', async function (t) { | ||
t.plan(4); | ||
@@ -239,3 +243,3 @@ | ||
cert: 'example-org-cert.pem' | ||
}, | ||
} | ||
}, function (err, servers) { | ||
@@ -293,3 +297,3 @@ t.error(err); | ||
cert: fs.readFileSync(path.resolve(root, 'example-org-cert.pem')), | ||
key: fs.readFileSync(path.resolve(root, 'example-org-key.pem')) | ||
key: fs.readFileSync(path.resolve(root, 'example-org-key.pem')) | ||
}, | ||
@@ -329,3 +333,5 @@ handler: fend | ||
var agent3Cert = fs.readFileSync(path.resolve(root, 'agent3-cert.pem')); | ||
var intermediate = fs.readFileSync(path.resolve(root, 'intermediate-cert.pem')); | ||
var intermediate = fs.readFileSync( | ||
path.resolve(root, 'intermediate-cert.pem') | ||
); | ||
var spy = sinon.spy(https, 'createServer'); | ||
@@ -338,3 +344,3 @@ createServers({ | ||
cert: ['agent3-cert.pem', 'intermediate-cert.pem'], | ||
key: 'agent3-key.pem' | ||
key: 'agent3-key.pem' | ||
}, | ||
@@ -369,3 +375,7 @@ handler: fend | ||
t.error(err); | ||
t.equals(spy.lastCall.args[0].requestCert, true, 'should preserve the requestCert option'); | ||
t.equals( | ||
spy.lastCall.args[0].requestCert, | ||
true, | ||
'should preserve the requestCert option' | ||
); | ||
servers.https.close(); | ||
@@ -379,7 +389,3 @@ spy.restore(); | ||
const hostNames = [ | ||
'example.com', | ||
'example.net', | ||
'foo.example.org', | ||
]; | ||
const hostNames = ['example.com', 'example.net', 'foo.example.org']; | ||
@@ -416,4 +422,5 @@ let httpsServer; | ||
const responses = await Promise.all(hostNames | ||
.map(hostname => download(`https://${hostname}:3456/`))); | ||
const responses = await Promise.all( | ||
hostNames.map(hostname => download(`https://${hostname}:3456/`)) | ||
); | ||
@@ -423,4 +430,4 @@ t.equals( | ||
true, | ||
'responses are as expected'); | ||
'responses are as expected' | ||
); | ||
} catch (err) { | ||
@@ -434,3 +441,3 @@ return void t.error(err); | ||
test('multiple https servers', async function(t) { | ||
test('multiple https servers', async function (t) { | ||
t.plan(2); | ||
@@ -437,0 +444,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56314
755