diff --git a/app.js b/app.js index e38655c..4c89b9d 100644 --- a/app.js +++ b/app.js @@ -38,7 +38,6 @@ app.post('/text', function(req, res) { mpq.track('incomplete request'); res.send({success:false,message:'Number and message parameters are required.'}); return; - } var ip = req.header('X-Real-IP');// || req.connection.remoteAddress; @@ -48,6 +47,11 @@ app.post('/text', function(req, res) { return; } + var message = req.body.message; + if (message.indexOf('http') === 0) { + message = ' ' + message; + } + var ipkey = 'textbelt:ip:' + ip + '_' + dateStr(); var phonekey = 'textbelt:phone:' + number; @@ -93,7 +97,7 @@ app.post('/text', function(req, res) { }); }, 1000*60*60*24); - sendText(req.body.number, req.body.message, function(err) { + sendText(req.body.number, message, function(err) { if (err) { mpq.track('sendText failed', {number: req.body.number, message: req.body.message, ip: ip}); res.send({success:false,message:'Communication with SMS gateway failed.'});