Some providers don't handle texts that begin with 'http' correctly.
Handle this.
This commit is contained in:
parent
cca5d7c462
commit
8fdc3e3610
8
app.js
8
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.'});
|
||||
|
Loading…
Reference in New Issue
Block a user