diff --git a/lib/request-options.js b/lib/request-options.js index 73780ba..6dee7ca 100644 --- a/lib/request-options.js +++ b/lib/request-options.js @@ -41,7 +41,7 @@ function RequestOptions(options, defaults) { this.passphrase = null; this.servername = null; this.secureProtocol = null; - this.rejectUnauthorized = null; + this.rejectUnauthorized = true; // all this.headers = {}; diff --git a/test/test-1-https.js b/test/test-1-https.js index 478b66b..0fbe52f 100644 --- a/test/test-1-https.js +++ b/test/test-1-https.js @@ -19,9 +19,11 @@ suite('https', function() { suiteSetup(function(done) { - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - - rail = new RAIL(); + rail = new RAIL({ + request: { + rejectUnauthorized: false + } + }); var options = { key: common.serverKey, @@ -55,8 +57,6 @@ suite('https', function() { suiteTeardown(function(done) { - delete process.env.NODE_TLS_REJECT_UNAUTHORIZED; - server.close(done); }); }); diff --git a/test/test-2-http2.js b/test/test-2-http2.js index c28ead0..6e023a1 100644 --- a/test/test-2-http2.js +++ b/test/test-2-http2.js @@ -55,7 +55,6 @@ suite('http2', function() { suiteTeardown(function() { delete process.env.NODE_TLS_REJECT_UNAUTHORIZED; - server.close(); // http2 does not emit an event }); }); diff --git a/test/test-global.js b/test/test-global.js index dc29995..abda7e6 100644 --- a/test/test-global.js +++ b/test/test-global.js @@ -19,13 +19,13 @@ suite('global', function() { suiteSetup(function(done) { - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - var options = { key: common.serverKey, cert: common.serverCert }; + RAIL.globalClient.defaults.rejectUnauthorized = false; + server = https.createServer(options, listener); server.listen(common.port, done); }); @@ -45,7 +45,7 @@ suite('global', function() { response.on('readable', function() { var data = response.read(); - if (data) { // node.js 0.12 tends to return null on first event + if (data) { body.push(data); } }); @@ -125,8 +125,6 @@ suite('global', function() { suiteTeardown(function(done) { - delete process.env.NODE_TLS_REJECT_UNAUTHORIZED; - server.close(done); }); }); diff --git a/test/test-https-redirect.js b/test/test-https-redirect.js index 4cb63ee..defb07d 100644 --- a/test/test-https-redirect.js +++ b/test/test-https-redirect.js @@ -19,12 +19,11 @@ suite('https:redirect', function() { suiteSetup(function(done) { - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - rail = new RAIL({ proto: 'https', request: { - port: common.port + port: common.port, + rejectUnauthorized: false } }); rail.use('redirect', {