mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 20:08:02 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
23 lines
605 B
JavaScript
23 lines
605 B
JavaScript
'use strict';
|
|
// This tests the situation where you try to connect a https client
|
|
// to an http server. You should get an error and exit.
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const https = require('https');
|
|
|
|
const server = http.createServer(common.fail);
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
const req = https.get({ port: this.address().port }, common.fail);
|
|
|
|
req.on('error', common.mustCall(function(e) {
|
|
console.log('Got expected error: ', e.message);
|
|
server.close();
|
|
}));
|
|
}));
|