Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware/token: store the token in current ctx #775

Merged
merged 3 commits into from
Nov 11, 2014

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Nov 10, 2014

A follow-up PR for #337.

See also the discussion in #569

/to @raymondfeng please review
/cc @ritch

@bajtos bajtos added the #review label Nov 10, 2014
@bajtos bajtos force-pushed the feature/save-token-in-context branch from b6dfd06 to dfa296b Compare November 10, 2014 18:13
@bajtos
Copy link
Member Author

bajtos commented Nov 10, 2014

@raymondfeng one of the older tests are failing, because loopback.getCurrentContext is not defined. I fixed that by providing a dummy loopback.getCurrentContext returning null.

I have also change the real implementation to return null when loopback.getCurrentContext is called from outside of a request-handling chain, e.g.

app.use(loopback.token()); // this calls getCurrentContext
app.use(loopback.context()): // the context is started here
app.use(loopback.rest());

LGTY?

Miroslav Bajtoš added 3 commits November 11, 2014 11:04
 - ensure the method is always defined

 - return `null` when the context is not active
   (we are not inside a request-handling chain)
@bajtos
Copy link
Member Author

bajtos commented Nov 11, 2014

@raymondfeng ping

@raymondfeng
Copy link
Member

LGTM

bajtos added a commit that referenced this pull request Nov 11, 2014
middleware/token: store the token in current ctx
@bajtos bajtos merged commit 46726f9 into master Nov 11, 2014
@bajtos bajtos removed the #review label Nov 11, 2014
@bajtos bajtos deleted the feature/save-token-in-context branch November 11, 2014 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants