Last active
July 13, 2022 06:06
-
-
Save ToroNZ/2e05230492e36c579758fd95c9ded879 to your computer and use it in GitHub Desktop.
JS HTTP Call Example
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 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