Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@benkroeger
Copy link
Contributor

subsequent token middleware tries to read token.id when enableDoublecheck: true. That caused a "Cannot read property id of null" error when the first middleware didn't actually find a valid accessToken.

@bajtos

fixes #2226

subsequent token middleware tries to read `token.id` when `enableDoublecheck: true`. That caused a "Cannot read property `id` of `null`" error when the first middleware didn't actually find a valid accessToken.
@slnode
Copy link

slnode commented Apr 13, 2016

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@bajtos
Copy link
Member

bajtos commented Apr 13, 2016

@slnode ok to test

.expect(200)
.end(function(err, res) {
if (err) return done(err);
expect(res.body).to.eql({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to check all token properties here? I am worried that if we add a new Token property in the future, we will have to fix way too many tests that don't really depend on specific Token properties.

It think it is enough to check that res.body.id is the same as token.id, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my last unit test, I did exactly that - and you commented that only checking on id wouldn't be enough.
Let me know which one you prefer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, sorry for me not being consistent! Let's keep what you have now.

@bajtos
Copy link
Member

bajtos commented Apr 13, 2016

@benkroeger thank you for the pull request. The patch looks good in general, I pointed out two details to improve in the comments above.

@bajtos bajtos self-assigned this Apr 13, 2016
@bajtos
Copy link
Member

bajtos commented Jun 13, 2016

Landed via 103935c, thank you for the contribution!

bajtos pushed a commit that referenced this pull request Jun 13, 2016
Subsequent token middleware tries to read `token.id`
when `enableDoublecheck: true`.
That caused a "Cannot read property `id` of `null`" error
when the first middleware didn't actually find a valid accessToken.

[back-port of #2227]
@benkroeger benkroeger deleted the hotfix/issue-2226 branch August 15, 2016 11:15
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.

Add missing unit test for token middleware

4 participants