-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
fix(core): fix global prefix not working #10801
fix(core): fix global prefix not working #10801
Conversation
BTW, people who face the same problem just like the code above, have to change |
1a56903
to
5deabef
Compare
Pull Request Test Coverage Report for Build 52907735-c558-46c4-92b9-7e9fb8f7ff77
💛 - Coveralls |
Now passed. |
}; | ||
if (useExcluded && Array.isArray(excludedRoutes)) { | ||
excludedRoutes.forEach(route => { | ||
router(route.path, mw); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use route.path
because route.pathRegex
is RegExp instead of string. Express support RegExp path. But Fastify do not support RexExp path, which is a pity.
lgtm |
I will look into this problem later. |
Yes, #9332 introduces a regression - since that we can't exclude the middleware with the format of <global prefix + path> |
@v-anton This PR has been reverted unfortunately. Maybe this bug still exist. Do you have any time to submit a bug report or fix it? |
PR #9332 fixes #9124, but will introduce a bug - the global prefix will not work if middleware register in
'*'
route. For example, run the code below and visithttp://localhost:3000/test
should not get{hello: 'hi'}
response, but actually will get. This meanssetGlobalPrefix
not work.This PR reverts #9332 and fixes #9124 and #9776.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #9124 and #9776
What is the new behavior?
Fix them.
Does this PR introduce a breaking change?
Other information