Merge pull request #1563 from lefnire/paglias/big-response
Reduce response size
This commit is contained in:
@@ -37,7 +37,8 @@ api.auth = function(req, res, next) {
|
||||
if (_.isEmpty(user)) {
|
||||
return res.json(401, NO_USER_FOUND);
|
||||
}
|
||||
res.locals.wasModified = +user._v !== +req.query._v;
|
||||
|
||||
res.locals.wasModified = req.query._v ? +user._v !== +req.query._v : true;
|
||||
res.locals.user = user;
|
||||
req.session.userId = user._id;
|
||||
return next();
|
||||
|
||||
@@ -710,7 +710,14 @@ api.batchUpdate = function(req, res, next) {
|
||||
response = user.toJSON();
|
||||
response.wasModified = res.locals.wasModified;
|
||||
if (response._tmp && response._tmp.drop) response.wasModified = true;
|
||||
res.json(200, response);
|
||||
|
||||
// Send the response to the server
|
||||
if(response.wasModified){
|
||||
res.json(200, response);
|
||||
}else{
|
||||
res.json(200, {_v: response._v});
|
||||
}
|
||||
|
||||
return console.log("Reply sent");
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user