Last active
April 22, 2016 01:41
-
-
Save oscarkuo/a6bd00b39192fbe46366bdcef63008fa to your computer and use it in GitHub Desktop.
Bypass bad SSL check in Node request
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
// npm i request-promise | |
// node node-bad-ssl-test.js | |
const rp = require('request-promise'); | |
const url = 'https://self-signed.badssl.com'; | |
const r1 = rp.get(url, { rejectUnauthorized: true }); | |
r1.then((body) => { | |
console.log(`with rejectUnauthorized => {${body}}`); | |
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | |
rp.get(url).then(body => console.log(`with NODE_TLS_REJECT_UNAUTHORIZED => {${body}}`)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment