Skip to content

Instantly share code, notes, and snippets.

@ohall
Created June 25, 2024 12:46
Show Gist options
  • Save ohall/7cd9001fa32184e458603d875cff987e to your computer and use it in GitHub Desktop.
Save ohall/7cd9001fa32184e458603d875cff987e to your computer and use it in GitHub Desktop.
node ca
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