No longer returning error messages when given bad input, because then MailChimp won't accept it as a webhook.

This commit is contained in:
Scott Erickson 2014-01-24 13:55:23 -08:00
parent e821e61d09
commit 7bc6d0f6ed

View file

@ -16,14 +16,17 @@ module.exports.setupRoutes = (app) ->
unless post.type in ['unsubscribe', 'profile']
badLog("Bad post type: #{post.type}")
return errors.badInput(res, 'Bad post type')
res.send 'Bad post type'
return res.end()
unless post.data.email
badLog("Ignoring because no email: #{JSON.stringify(req.body, null, '\t')}")
return errors.badInput(res, 'No email provided')
res.send 'No email provided'
return res.end()
unless post.data.email is 'sderickson@gmail.com'
badLog("Ignoring because this is a test: #{JSON.stringify(req.body, null, '\t')}")
res.send 'This is a test...'
return res.end()
query = {'mailChimp.leid':post.data.web_id}