Include key in http response

This commit is contained in:
Ian 2014-04-20 19:01:21 -07:00
parent 22c4b4183c
commit eaf887fa5c

14
app.js
View File

@ -80,16 +80,22 @@ function textRequestHandler(req, res, number, region, key) {
ip: ip
};
var doSendText = function() {
var doSendText = function(response_obj) {
response_obj = response_obj || {};
// Time to actually send the message
sendText(req.body.number, message, region, function(err) {
if (err) {
mpq.track('sendText failed', tracking_details);
res.send({success:false, message:'Communication with SMS gateway failed.'});
res.send(_.extend(response_obj,
{
success:false,
message:'Communication with SMS gateway failed.'
}));
}
else {
mpq.track('sendText success', tracking_details);
res.send({success:true});
res.send(_.extend(response_obj, {success:true}));
}
});
};
@ -101,7 +107,7 @@ function textRequestHandler(req, res, number, region, key) {
mpq.track('sendText skipping verification', _.extend(tracking_details, {
key: key,
}));
doSendText();
doSendText({used_key: key});
return;
}