Created
July 27, 2016 13:27
-
-
Save rjnienaber/87a1427e5084c5bb277084de70e8d2ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var fs = require('fs'); | |
var url = process.argv[2]; // url of the site | |
var certFile = process.argv[3]; // certificate from server | |
var ca = fs.readFileSync(certFile, 'ascii'); | |
var options = { | |
url: url, | |
// rejectUnauthorized: false, | |
ca: ca | |
}; | |
var test = request.get(options, function (error, response, body) { | |
if (error) { | |
console.log('Error'); | |
console.log(JSON.stringify(error, null, 4)); | |
} else { | |
delete response['body']; | |
console.log(JSON.stringify(response, null, 4)) // Show the HTML for the Google homepage. | |
} | |
}); | |
// NODE 4.4.7 (Ubuntu 16.04 LTS) | |
// Error | |
// { | |
// "code": "UNABLE_TO_GET_ISSUER_CERT" | |
// } | |
// NODE 6.0.0 (Ubuntu 16.04 LTS) | |
// { | |
// "statusCode": 200, | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment