Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- handleSend: function(req, res, data){
- if( ! data ) {
- data = {};
- }
- // add classic status
- data.status = res.statusCode;
- // add debug dump
- if( sails.config.environment === 'development' ){
- data._debug = {
- api_version: sails.config.general.apiVersion,
- locale: res.locale,
- region: res.region,
- session: req.session,
- sessionID: req.sessionID,
- sessionStore: req.sessionStore,
- signedCookies: req.signedCookies
- }
- }
- // If the user-agent wants JSON, always respond with JSON
- if ( req.wantsJSON ) {
- return res.send( data );
- }
- else{
- // Not implemented
- return res.send(400);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement