More tests

This commit is contained in:
Klemek
2019-06-22 11:00:02 +02:00
parent d343179764
commit def326676c
4 changed files with 55 additions and 32 deletions
+1 -4
View File
@@ -154,10 +154,7 @@ module.exports = (config) => {
app.post(config['webhook']['endpoint'], (req, res) => {
if (config['modules']['webhook']) {
if (config['webhook']['signature_header'] && config['webhook']['secret']) {
const payload = JSON.stringify(req.body);
if (!payload) {
return res.sendStatus(403);
}
const payload = JSON.stringify(req.body) || '';
const hmac = crypto.createHmac('sha1', config['webhook']['secret']);
const digest = 'sha1=' + hmac.update(payload).digest('hex');
const checksum = req.headers[config['webhook']['signature_header']];