Skip to content

Instantly share code, notes, and snippets.

@ToroNZ
Last active July 13, 2022 06:06
Show Gist options
  • Save ToroNZ/2e05230492e36c579758fd95c9ded879 to your computer and use it in GitHub Desktop.
Save ToroNZ/2e05230492e36c579758fd95c9ded879 to your computer and use it in GitHub Desktop.
JS HTTP Call Example
const https = require('https');
const options = {
hostname: 'portal-uat-v5.australiansuper.com',
port: 443,
path: '/',
method: 'GET'
};
const req = https.request(options, (res) => {
console.log('statusCode:', res.statusCode);
console.log('headers:', res.connection.remoteAddress);
// console.log('socket', res.socket);
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