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
feat: access handler name add properties to req route options #4470
feat: access handler name add properties to req route options #4470
Conversation
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.
The request.routeOptions should be immutable
test is failing, it could be due to the new warning
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
lib/request.js
Outdated
@@ -171,6 +172,7 @@ Object.defineProperties(Request.prototype, { | |||
const routeLimit = context._parserOptions.limit | |||
const serverLimit = context.server.initialConfig.bodyLimit | |||
const version = context.server.hasConstraintStrategy('version') ? this.raw.headers['accept-version'] : undefined | |||
const { handler, config } = context |
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.
You are taking the reference here and config
is an object.
When you deep frozen the object, altering config
in else where will be break.
The getter should be immutable, but the hidden value should be allowed to modify by the core.
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.
ptal
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Two comments to be addressed:
then we can land this |
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
Is this even related to this PR? Cant you patch your code accordingly? |
From my understanding, only a doc update is missing. So you can probably suggest changes here or PR the fork. |
I think this is related to another issue for the opentelemetry which is blocked by this PR? open-telemetry/opentelemetry-js-contrib#1275 |
…rties-to-req-route-options
I think @SimenB wanted to actually say, that this PR would also add more warnings to the opentelemetry issue. |
To fix the issue in opentelemetry, you would need to patch There I think you would need to change it to: const handlerName = (((request as any).routeConfig || {})?.name || '').substr(6); |
Just took another look at this PR- yes you're right. Sorry about this. Guess there's some work needed to do on the opentelemetry side then. Edit: thank you for the patching instruction above! I'll try. |
…rties-to-req-route-options
I fixed the remaining remarks. It should be ready for merge. @Eomm PTAL |
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
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.
We will need to check these warnings across the repos
Thanks GH code search
…rties-to-req-route-options
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.
lgtm
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.dev/) ([source](https://togithub.com/fastify/fastify)) | [`4.22.2` -> `4.23.0`](https://renovatebot.com/diffs/npm/fastify/4.22.2/4.23.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.23.0`](https://togithub.com/fastify/fastify/releases/tag/v4.23.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.22.2...v4.23.0) #### What's Changed - test: reduce output of reqIdGenFactory.test.js by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5012 - feat: Add onListen Hook by [@​BrendenInhelder](https://togithub.com/BrendenInhelder) in [fastify/fastify#4899 - docs(readme): avoid line breaks in documentation links by [@​antoineneff](https://togithub.com/antoineneff) in [fastify/fastify#5014 - chore(examples): added curly braces to conditions for consistency by [@​turnerran](https://togithub.com/turnerran) in [fastify/fastify#5015 - feat: access handler name add properties to req route options by [@​cesarvspr](https://togithub.com/cesarvspr) in [fastify/fastify#4470 - chore: Bump the dev-dependencies group with 1 update by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#5018 - docs: minor improvements by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5019 - chore(deps): replace tiny-lru with toad-cache by [@​kibertoad](https://togithub.com/kibertoad) in [fastify/fastify#4668 - docs(ecosystem.md): Fix wrong entry for ecosystem.md by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5021 - perf: use `node:` prefix to bypass require.cache call for builtins by [@​Fdawgs](https://togithub.com/Fdawgs) in [fastify/fastify#5026 - docs(typo): mistype of monkeypatch by [@​Menkveld-24](https://togithub.com/Menkveld-24) in [fastify/fastify#5027 - chore: change website to .dev instead of .io by [@​Eomm](https://togithub.com/Eomm) in [fastify/fastify#5028 - chore: add gurgunday and uzlopak as contributors by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5029 - chore: add a citgm command to customize what we run in CITGM by [@​mcollina](https://togithub.com/mcollina) in [fastify/fastify#5030 #### New Contributors - [@​BrendenInhelder](https://togithub.com/BrendenInhelder) made their first contribution in [fastify/fastify#4899 - [@​antoineneff](https://togithub.com/antoineneff) made their first contribution in [fastify/fastify#5014 - [@​turnerran](https://togithub.com/turnerran) made their first contribution in [fastify/fastify#5015 - [@​Menkveld-24](https://togithub.com/Menkveld-24) made their first contribution in [fastify/fastify#5027 **Full Changelog**: fastify/fastify@v4.22.2...v4.23.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/tomacheese/telcheck). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.dev/) ([source](https://togithub.com/fastify/fastify)) | [`4.22.2` -> `4.23.0`](https://renovatebot.com/diffs/npm/fastify/4.22.2/4.23.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.23.0`](https://togithub.com/fastify/fastify/releases/tag/v4.23.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.22.2...v4.23.0) ##### What's Changed - test: reduce output of reqIdGenFactory.test.js by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5012 - feat: Add onListen Hook by [@​BrendenInhelder](https://togithub.com/BrendenInhelder) in [fastify/fastify#4899 - docs(readme): avoid line breaks in documentation links by [@​antoineneff](https://togithub.com/antoineneff) in [fastify/fastify#5014 - chore(examples): added curly braces to conditions for consistency by [@​turnerran](https://togithub.com/turnerran) in [fastify/fastify#5015 - feat: access handler name add properties to req route options by [@​cesarvspr](https://togithub.com/cesarvspr) in [fastify/fastify#4470 - chore: Bump the dev-dependencies group with 1 update by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#5018 - docs: minor improvements by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5019 - chore(deps): replace tiny-lru with toad-cache by [@​kibertoad](https://togithub.com/kibertoad) in [fastify/fastify#4668 - docs(ecosystem.md): Fix wrong entry for ecosystem.md by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5021 - perf: use `node:` prefix to bypass require.cache call for builtins by [@​Fdawgs](https://togithub.com/Fdawgs) in [fastify/fastify#5026 - docs(typo): mistype of monkeypatch by [@​Menkveld-24](https://togithub.com/Menkveld-24) in [fastify/fastify#5027 - chore: change website to .dev instead of .io by [@​Eomm](https://togithub.com/Eomm) in [fastify/fastify#5028 - chore: add gurgunday and uzlopak as contributors by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5029 - chore: add a citgm command to customize what we run in CITGM by [@​mcollina](https://togithub.com/mcollina) in [fastify/fastify#5030 ##### New Contributors - [@​BrendenInhelder](https://togithub.com/BrendenInhelder) made their first contribution in [fastify/fastify#4899 - [@​antoineneff](https://togithub.com/antoineneff) made their first contribution in [fastify/fastify#5014 - [@​turnerran](https://togithub.com/turnerran) made their first contribution in [fastify/fastify#5015 - [@​Menkveld-24](https://togithub.com/Menkveld-24) made their first contribution in [fastify/fastify#5027 **Full Changelog**: fastify/fastify@v4.22.2...v4.23.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/redwoodjs/redwood). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [fastify](https://www.fastify.dev/) ([source](https://togithub.com/fastify/fastify)) | [`4.22.2` -> `4.23.0`](https://renovatebot.com/diffs/npm/fastify/4.22.2/4.23.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>fastify/fastify (fastify)</summary> ### [`v4.23.0`](https://togithub.com/fastify/fastify/releases/tag/v4.23.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.22.2...v4.23.0) ##### What's Changed - test: reduce output of reqIdGenFactory.test.js by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5012 - feat: Add onListen Hook by [@​BrendenInhelder](https://togithub.com/BrendenInhelder) in [fastify/fastify#4899 - docs(readme): avoid line breaks in documentation links by [@​antoineneff](https://togithub.com/antoineneff) in [fastify/fastify#5014 - chore(examples): added curly braces to conditions for consistency by [@​turnerran](https://togithub.com/turnerran) in [fastify/fastify#5015 - feat: access handler name add properties to req route options by [@​cesarvspr](https://togithub.com/cesarvspr) in [fastify/fastify#4470 - chore: Bump the dev-dependencies group with 1 update by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#5018 - docs: minor improvements by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5019 - chore(deps): replace tiny-lru with toad-cache by [@​kibertoad](https://togithub.com/kibertoad) in [fastify/fastify#4668 - docs(ecosystem.md): Fix wrong entry for ecosystem.md by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5021 - perf: use `node:` prefix to bypass require.cache call for builtins by [@​Fdawgs](https://togithub.com/Fdawgs) in [fastify/fastify#5026 - docs(typo): mistype of monkeypatch by [@​Menkveld-24](https://togithub.com/Menkveld-24) in [fastify/fastify#5027 - chore: change website to .dev instead of .io by [@​Eomm](https://togithub.com/Eomm) in [fastify/fastify#5028 - chore: add gurgunday and uzlopak as contributors by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#5029 - chore: add a citgm command to customize what we run in CITGM by [@​mcollina](https://togithub.com/mcollina) in [fastify/fastify#5030 ##### New Contributors - [@​BrendenInhelder](https://togithub.com/BrendenInhelder) made their first contribution in [fastify/fastify#4899 - [@​antoineneff](https://togithub.com/antoineneff) made their first contribution in [fastify/fastify#5014 - [@​turnerran](https://togithub.com/turnerran) made their first contribution in [fastify/fastify#5015 - [@​Menkveld-24](https://togithub.com/Menkveld-24) made their first contribution in [fastify/fastify#5027 **Full Changelog**: fastify/fastify@v4.22.2...v4.23.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/redwoodjs/redwood). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Closes #4439
Checklist
npm run test
andnpm run benchmark
and the Code of conduct