Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. handleSend: function(req, res, data){
  2.  
  3.         if( ! data ) {
  4.             data = {};
  5.         }
  6.         // add classic status
  7.         data.status = res.statusCode;
  8.  
  9.         // add debug dump
  10.         if( sails.config.environment === 'development' ){
  11.             data._debug = {
  12.                 api_version: sails.config.general.apiVersion,
  13.                 locale: res.locale,
  14.                 region: res.region,
  15.                 session: req.session,
  16.                 sessionID: req.sessionID,
  17.                 sessionStore: req.sessionStore,
  18.                 signedCookies: req.signedCookies
  19.             }
  20.         }
  21.  
  22.         // If the user-agent wants JSON, always respond with JSON
  23.         if ( req.wantsJSON ) {
  24.             return res.send( data );
  25.         }
  26.         else{
  27.  
  28.             // Not implemented
  29.             return res.send(400);
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement