Skip to content

Instantly share code, notes, and snippets.

@sjehutch
Created May 13, 2018 13:11
Show Gist options
  • Save sjehutch/979e6ed358b3eafc8b01e1f20d70e381 to your computer and use it in GitHub Desktop.
Save sjehutch/979e6ed358b3eafc8b01e1f20d70e381 to your computer and use it in GitHub Desktop.
getHTTPS-node
var https = require('https');
exports.handler = function(event, context) {
var req = https.request(event.url, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
///event.url is the full URL passed into the function by the test stin in lambda
//{
//"url":"https://www.google.com"
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment