twilio-webhooks
Advanced tools
Comparing version 2.0.8 to 2.0.9
{ | ||
"name": "twilio-webhooks", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "Process webhooks sent by Twilio", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "b68f0acaa9cbc87bfb077edd3657c093c37c337f" | ||
"gitHead": "0826bc0e393692611c23e8e5be7e24eb8b661dba" | ||
} |
@@ -29,4 +29,10 @@ require('./tracer').initTracer(); | ||
app.use(express.urlencoded({ extended: false, limit: '50mb' })); | ||
app.use(express.json()); | ||
app.all('/message-delivery-status', handleMessageDeliveryStatus); | ||
app.all('/message-delivery-status', (req, res, next) => { | ||
logger.info('test', { | ||
meta: { body: req.body } | ||
}); | ||
next(); | ||
}, handleMessageDeliveryStatus); | ||
@@ -33,0 +39,0 @@ app.all('/health', (req, res) => { |
@@ -50,8 +50,8 @@ const baseLogger = require('../logger'); | ||
module.exports = async function handleMessageDeliverStatus (req, res) { | ||
const { app: { locals: { context } } } = req; | ||
module.exports = async (req, res) => { | ||
const { body, app: { locals: { context } } } = req; | ||
try { | ||
logger.info('req.body', req.body); | ||
if (!isValidRequest(req.body)) { | ||
logger.info('req.body1', req.body); | ||
logger.info('body', body); | ||
if (!isValidRequest(body)) { | ||
logger.info('body1', body); | ||
res.writeHead(500, { 'Content-Type': 'text/xml' }); | ||
@@ -61,6 +61,6 @@ res.end(); | ||
} | ||
logger.info('req.body2', req.body); | ||
logger.info('body2', body); | ||
const messageStatus = req.body.MessageStatus; | ||
const messageSid = req.body.MessageSid; | ||
const messageStatus = body.MessageStatus; | ||
const messageSid = body.MessageSid; | ||
switch (messageStatus) { | ||
@@ -67,0 +67,0 @@ case 'queued': |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6633
181