in source/lambda/services/slacknotify/lib/slack-notify.js [177:205]
postMessage(slackurl, message, callback) {
const _self = this;
const body = JSON.stringify(message);
const options = url.parse(slackurl);
options.method = 'POST';
options.headers = {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(body),
};
const postReq = https.request(options, res => {
const chunks = [];
res.setEncoding('utf8');
res.on('data', chunk => chunks.push(chunk));
res.on('end', () => {
if (callback) {
callback({
body: chunks.join(''),
statusCode: res.statusCode,
statusMessage: res.statusMessage,
});
}
});
return res;
});
postReq.write(body);
postReq.end();
}