Created
May 13, 2018 13:11
-
-
Save sjehutch/979e6ed358b3eafc8b01e1f20d70e381 to your computer and use it in GitHub Desktop.
getHTTPS-node
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
| 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