Merge pull request #2604 from strongloop/fix/lazy-cls

Fix token middleware to not trigger CLS init
This commit is contained in:
Miroslav Bajtoš 2016-08-12 09:32:03 +02:00 committed by GitHub
commit 3719ac4bb9
1 changed files with 1 additions and 1 deletions

View File

@ -124,7 +124,7 @@ function token(options) {
TokenModel.findForRequest(req, options, function(err, token) { TokenModel.findForRequest(req, options, function(err, token) {
req.accessToken = token || null; req.accessToken = token || null;
rewriteUserLiteral(req, currentUserLiteral); rewriteUserLiteral(req, currentUserLiteral);
var ctx = loopback.getCurrentContext(); var ctx = req.loopbackContext;
if (ctx) ctx.set('accessToken', token); if (ctx) ctx.set('accessToken', token);
next(err); next(err);
}); });