mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip Backport-PR-URL: https://github.com/nodejs/node/pull/14838 PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
20 lines
608 B
JavaScript
20 lines
608 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');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const http = require('http');
|
|
const https = require('https');
|
|
const server = http.createServer(common.mustNotCall());
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
const req = https.get({ port: this.address().port }, common.mustNotCall());
|
|
|
|
req.on('error', common.mustCall(function(e) {
|
|
console.log('Got expected error: ', e.message);
|
|
server.close();
|
|
}));
|
|
}));
|