honojs / hono

Web framework built on Web Standards
https://hono.dev
MIT License
20.38k stars 584 forks source link

feat(request): Make request.ts available throught JSR for frameworks that need to instantiate HonoRequest #3425

Closed Sorikairox closed 1 month ago

Sorikairox commented 1 month ago

The author should do the following, if applicable

yusukebe commented 1 month ago

Hey @Sorikairox

Thank you for the PR! The request.ts is not exported for the npm package, not only for Deno. I want to know the situation if you want to use the HonoRequest class. Can you share the use case for using the HonoRequest class?

Sorikairox commented 1 month ago

@yusukebe

Thanks for your answer !

The context is for our framework Danet (https://github.com/savory/Danet).

For the past 12 months or so until last week, we were using Hono's deno.land/x/ version, where everything was accessible. I decided to migrate to JSR, which is why I noticed that the class was not accessible.

To keep it simple, in order to allow our internal logic and our users to use the same code with either HTTP request or Websocket message, we instantiate a HonoRequest for the latter.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.77%. Comparing base (dfbd717) to head (6fa0db1). Report is 10 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3425 +/- ## ======================================= Coverage 95.77% 95.77% ======================================= Files 155 155 Lines 9310 9310 Branches 2725 2757 +32 ======================================= Hits 8917 8917 Misses 393 393 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

yusukebe commented 1 month ago

@Sorikairox

Thank you for your explanation! I understood well. I'll merge this into main later and include it in the next patch release. In the npm package, the request.ts also may be exported.