-
Notifications
You must be signed in to change notification settings - Fork 2k
Possible error in the logical flow of the middleware sub-stack example provided in the website. #2022
Nishant-Dwivedi
started this conversation in
Content
-
Description
Expectations
I could be wrong but i think you need to either remove the bang in front of req.headers['x-auth'] or swap next('route') with next().
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments
-
Hi @Nishant-Dwivedi , thanks for suggesting. I think the current logic is correct though — the ! is intentional because we want to block requests that are missing the x-auth header.
Also, we use next('router') to skip the rest of the router if the header is missing, so it falls through to the 401 handler.
I think we need to improve our documentation on next().
Cc @expressjs/docs-wg
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
0 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment