HonoH
Hono4mo ago
Whimsy

export Context class as value not as type

@yusukebe Hi, I’ve noticed multiple GitHub issues where developers request access to the Context class. This isn’t just a niche use case—many of us need it for testing, extending functionality, or building features that depend on consistent request handling.

In my case, I specifically need Context to implement a unified handler for both WebSocket and HTTPS, and while it works, I literally had to download context.ts from the repo just to use it. That feels like a workaround that shouldn’t be necessary.

I understand your concern that exposing Context might lead to confusion or unexpected usage. However, many other libraries solve this by making such internals available while clearly stating that they’re unsupported or may change without notice. That way, advanced users can build what they need without being blocked, while beginners remain unaffected. And what if someone raises an issue, just close it or someone from community can help.

Given how many developers are requesting this, I strongly believe it should be treated as a necessity rather than a hidden implementation detail. Could you reconsider making Context officially accessible, even with a disclaimer attached?
Was this page helpful?