52 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2016-10-20 12:39:05 -06:00
'use strict';
testDefault();
// backwards compat
function testDefault() {
require('https').globalAgent.options.ca = null;
var rootCas = require('./latest');
var request = require('@coolaj86/urequest');
2016-10-20 12:39:05 -06:00
require('https').globalAgent.options.ca = rootCas;
2018-02-13 11:55:22 -07:00
request.get('https://coolaj86.com/404.html', function (err, resp, body) {
2016-10-20 12:39:05 -06:00
if (err) {
throw err;
}
testInject();
});
}
function testInject() {
require('https').globalAgent.options.ca = null;
var rootCas = require('./latest').inject();
var request = require('@coolaj86/urequest');
2016-10-20 12:39:05 -06:00
require('https').globalAgent.options.ca = rootCas;
2018-02-13 11:55:22 -07:00
request.get('https://coolaj86.com/404.html', function (err, resp, body) {
2016-10-20 12:39:05 -06:00
if (err) {
throw err;
}
testCreate();
});
}
function testCreate() {
require('https').globalAgent.options.ca = null;
var rootCas = require('./latest').create();
var request = require('@coolaj86/urequest');
2016-10-20 12:39:05 -06:00
require('https').globalAgent.options.ca = rootCas;
2018-02-13 11:55:22 -07:00
request.get('https://coolaj86.com/404.html', function (err, resp, body) {
2016-10-20 12:39:05 -06:00
if (err) {
throw err;
}
console.log(body);
});
}
// TODO test with a company certificate