nest
nest copied to clipboard
fix(core): resolve :param retrieval in prefix in middleware
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
Issue Number: #13401, #9776
PR #11832 caused issue #9776 when a global prefix was set and the exclude parameter was configured. Therefore, I reverted PR #11832 and fixed the issue it addressed using an alternative approach.
I added test cases based on the minimal reproduction code provided in #13401. This PR also resolves the issue in #13401.
The recent issues with middleware execution not behaving as expected all originate from PR #10390, which was implemented to resolve issue #9776. However, it has become clear that the changes introduced in that PR had too broad an impact. Therefore, in this PR, I have adjusted the logic so that the changes from PR #10390 only apply in cases where the prefix path contains :param, thereby minimizing the effect on most users.
What is the new behavior?
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Other information
Pull Request Test Coverage Report for Build b968c84f-c249-4618-83c5-cc0f355b039a
Details
- 18 of 18 (100.0%) changed or added relevant lines in 1 file are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.01%) to 92.226%
| Totals | |
|---|---|
| Change from base Build 71551605-c356-4a76-8f46-8de2acf07906: | 0.01% |
| Covered Lines: | 6762 |
| Relevant Lines: | 7332 |