Created
June 25, 2024 12:46
-
-
Save ohall/7cd9001fa32184e458603d875cff987e to your computer and use it in GitHub Desktop.
node ca
This file contains hidden or 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
| const https = require('https'); | |
| const fs = require('fs'); | |
| const options = { | |
| hostname: 'example.com', | |
| port: 443, | |
| path: '/', | |
| method: 'GET', | |
| ca: fs.readFileSync('path/to/self-signed-cert.pem') | |
| }; | |
| const req = https.request(options, (res) => { | |
| console.log('statusCode:', res.statusCode); | |
| console.log('headers:', res.headers); | |
| res.on('data', (d) => { | |
| process.stdout.write(d); | |
| }); | |
| }); | |
| req.on('error', (e) => { | |
| console.error(e); | |
| }); | |
| req.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment