Created
September 8, 2020 03:15
-
-
Save mobsense/d5c54708116e8095209c3767b2304875 to your computer and use it in GitHub Desktop.
Sending a HTTP request without waiting for a response in Lambda
This file contains 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 URL = require('url') | |
async function request(url, data) { | |
return new Promise((resolve, reject) => { | |
let req = https.request(URL.parse(url)) | |
req.write(data) | |
req.end(null, null, () => { | |
/* Request has been fully sent */ | |
resolve(req) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment