Skip to content

feat: inherit req.context and ServerRequestContext types#1194

Merged
pi0 merged 3 commits into
mainfrom
feat/inherit-ctx
Aug 27, 2025
Merged

feat: inherit req.context and ServerRequestContext types#1194
pi0 merged 3 commits into
mainfrom
feat/inherit-ctx

Conversation

@pi0

@pi0 pi0 commented Aug 27, 2025

Copy link
Copy Markdown
Member

This PR adds support for ServerRequest.context to be automatically used for H3Event.context instead of initiating another ref for broader compatibility.

Also now h3.H3EventContext inherits srvxServerRequestContext for sharing types (this is a slight change as Record<string, any> is changed to ~ Record<string, unkown> and untyped context keys are unknown)

Note: We do not sync H3Event.context back to Request.context as this could cause side-effects from library. It happens only from Request => H3Event.

@codecov

codecov Bot commented Aug 27, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/adapters.ts 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@pi0 pi0 changed the title feat: inherit request.context if exists feat: inherit req.context and ServerRequestContext types Aug 27, 2025
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 27, 2025

Copy link
Copy Markdown

Deploying h3dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a08457
Status: ✅  Deploy successful!
Preview URL: https://749c3398.h3dev.pages.dev
Branch Preview URL: https://feat-inherit-ctx.h3dev.pages.dev

View logs

@pi0
pi0 merged commit 70261d5 into main Aug 27, 2025
4 of 5 checks passed
@pi0
pi0 deleted the feat/inherit-ctx branch August 27, 2025 10:52
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