Include key in http response
This commit is contained in:
		
							
								
								
									
										14
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								app.js
									
									
									
									
									
								
							@@ -80,16 +80,22 @@ function textRequestHandler(req, res, number, region, key) {
 | 
				
			|||||||
    ip: ip
 | 
					    ip: ip
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var doSendText = function() {
 | 
					  var doSendText = function(response_obj) {
 | 
				
			||||||
 | 
					    response_obj = response_obj || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Time to actually send the message
 | 
					    // Time to actually send the message
 | 
				
			||||||
    sendText(req.body.number, message, region, function(err) {
 | 
					    sendText(req.body.number, message, region, function(err) {
 | 
				
			||||||
      if (err) {
 | 
					      if (err) {
 | 
				
			||||||
        mpq.track('sendText failed', tracking_details);
 | 
					        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 {
 | 
					      else {
 | 
				
			||||||
        mpq.track('sendText success', tracking_details);
 | 
					        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, {
 | 
					    mpq.track('sendText skipping verification', _.extend(tracking_details, {
 | 
				
			||||||
      key: key,
 | 
					      key: key,
 | 
				
			||||||
    }));
 | 
					    }));
 | 
				
			||||||
    doSendText();
 | 
					    doSendText({used_key: key});
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user