Skip to content

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

Merged
pi0 merged 2 commits intomainfrom
refactor/use-event-1
Jul 24, 2023
Merged

refactor: use event.path instead of event.node.req.url #438
pi0 merged 2 commits intomainfrom
refactor/use-event-1

Conversation

@pi0
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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