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: cleanup event interface #506

Merged
merged 6 commits into from
Aug 14, 2023
Merged

refactor: cleanup event interface #506

merged 6 commits into from
Aug 14, 2023

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Aug 14, 2023

πŸ”— Linked issue

❓ 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

Before releasing h3 1.8, this PR makes sure we minimize new interface changes and chances of future possible breaking changes.

Meanwhile, I was trying new Web APIs, and figured it is so easy to shoot in the foot by runtime expensive getters such as event.url or event.request (did myself ironically!). Composable utils are a little bit more verbose to use but also easy to replace or deprecate.

Changes from the last RC:

  • Move event.rawBody to getRequestWebStream(event)
  • Move event.request to toWebRequest(event)
  • Move top-level web context to event.web? (WebEventContext = { request, url })
  • Drop event._originalPath internal getter
  • Drop event._hasBody internal getter
  • Move event.url to getRequestURL(event)
  • Fixed an unseen issue with readRawBody and readBody to support web request body streams
  • Simplify getRequestPath to only normalize trailing double slashes
  • Revert getRequestPath to 1.7.1 implementation and deprecate

πŸ“ Checklist

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

@pi0 pi0 marked this pull request as ready for review August 14, 2023 17:10
@codecov
Copy link

codecov bot commented Aug 14, 2023

Codecov Report

Merging #506 (a798f6e) into main (588c8a3) will increase coverage by 0.03%.
The diff coverage is 88.28%.

@@            Coverage Diff             @@
##             main     #506      +/-   ##
==========================================
+ Coverage   82.40%   82.43%   +0.03%     
==========================================
  Files          31       31              
  Lines        3580     3604      +24     
  Branches      531      539       +8     
==========================================
+ Hits         2950     2971      +21     
- Misses        630      633       +3     
Files Changed Coverage Ξ”
src/utils/proxy.ts 83.81% <50.00%> (ΓΈ)
src/adapters/plain.ts 79.35% <66.66%> (+0.13%) ⬆️
src/adapters/web.ts 94.82% <66.66%> (ΓΈ)
src/event/event.ts 86.61% <86.84%> (-1.96%) ⬇️
src/utils/request.ts 92.70% <90.47%> (-0.07%) ⬇️
src/utils/body.ts 94.55% <91.80%> (-0.91%) ⬇️

@pi0 pi0 merged commit 8079fa9 into main Aug 14, 2023
6 checks passed
@pi0 pi0 deleted the refactor/event-url branch August 14, 2023 17:38
@pi0 pi0 mentioned this pull request Aug 14, 2023
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.

1 participant