Skip to content
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

refactor: use event.path instead of event.node.req.url #438

Merged
merged 2 commits into from
Jul 24, 2023

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Jul 11, 2023

…al utils

πŸ”— Linked issue

#73

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR:

  • Introduces event._originalPath internal (resolves use event._originalPath internal helperΒ #435)
  • Introduces event._path internal and uses it to cache+override event.path getter value
  • Deprecates getRequestPath(event) to prefer event.path
  • Updates app (important!!), router and request URLs to use event.path instead of event.node.req.url

With this, we reduce dependency in event.node

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0 pi0 marked this pull request as draft July 11, 2023 16:15
@pi0
Copy link
Member Author

pi0 commented Jul 11, 2023

Need to triple check this is important to avoid perf penalties and regression πŸ˜…

@pi0 pi0 marked this pull request as ready for review July 24, 2023 15:20
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #438 (14fccaf) into main (27a1bd0) will increase coverage by 0.13%.
The diff coverage is 97.72%.

❗ Current head 14fccaf differs from pull request most recent head 1efa2c2. Consider uploading reports for the commit 1efa2c2 to get more accurate results

@@            Coverage Diff             @@
##             main     #438      +/-   ##
==========================================
+ Coverage   77.76%   77.89%   +0.13%     
==========================================
  Files          26       26              
  Lines        2698     2705       +7     
  Branches      399      393       -6     
==========================================
+ Hits         2098     2107       +9     
+ Misses        600      598       -2     
Impacted Files Coverage Ξ”
src/event/event.ts 65.30% <93.75%> (+2.98%) ⬆️
src/app.ts 97.68% <100.00%> (+0.05%) ⬆️
src/router.ts 98.47% <100.00%> (-0.03%) ⬇️
src/utils/request.ts 100.00% <100.00%> (ΓΈ)
src/utils/route.ts 89.47% <100.00%> (+1.97%) ⬆️

... and 1 file with indirect coverage changes

@pi0
Copy link
Member Author

pi0 commented Jul 24, 2023

Have made some additional tests seems all is fine also with compatibility.

Heads up @danielroe @antfu @atinux if you discovered any issues with next release please ping me to quickly check.

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.

use event._originalPath internal helper
1 participant