|
|
@ -13,21 +13,21 @@ const createTestServer = opts => Promise.all([ |
|
|
|
createCert(opts && opts.certificate) |
|
|
|
]) |
|
|
|
.then(results => { |
|
|
|
const port = results[0]; |
|
|
|
const sslPort = results[1]; |
|
|
|
const cert = results[2]; |
|
|
|
|
|
|
|
const app = express(); |
|
|
|
app.port = results[0]; |
|
|
|
app.sslPort = results[1]; |
|
|
|
app.caCert = cert.caKeys.cert; |
|
|
|
app.host = 'localhost'; |
|
|
|
app.url = `http://${app.host}:${app.port}`; |
|
|
|
app.sslUrl = `https://${app.host}:${app.sslPort}`; |
|
|
|
app.url = `http://localhost:${port}`; |
|
|
|
app.sslUrl = `https://localhost:${sslPort}`; |
|
|
|
|
|
|
|
const server = http.createServer(app); |
|
|
|
const sslServer = https.createServer(cert.keys, app); |
|
|
|
|
|
|
|
app.listen = () => Promise.all([ |
|
|
|
pify(server.listen.bind(server))(app.port), |
|
|
|
pify(sslServer.listen.bind(sslServer))(app.sslPort) |
|
|
|
pify(server.listen.bind(server))(port), |
|
|
|
pify(sslServer.listen.bind(sslServer))(sslPort) |
|
|
|
]); |
|
|
|
app.close = () => Promise.all([ |
|
|
|
pify(server.close.bind(server))(), |
|
|
|