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

fix(helper/websocket): allow custom events to be passed to generics #3616

Merged
merged 5 commits into from
Nov 3, 2024

Conversation

EdamAme-x
Copy link
Contributor

@EdamAme-x EdamAme-x commented Nov 3, 2024

Closes: #3610

Also, make the onOpen event, which is not available in cloudflare-workers, not included in the type.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@EdamAme-x
Copy link
Contributor Author

No suggestions
image

Copy link

codecov bot commented Nov 3, 2024

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.77%. Comparing base (ae6165b) to head (8339b84).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/adapter/cloudflare-workers/websocket.ts 94.28% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3616      +/-   ##
==========================================
+ Coverage   89.74%   89.77%   +0.02%     
==========================================
  Files         158      158              
  Lines       10094    10090       -4     
  Branches     2827     2825       -2     
==========================================
- Hits         9059     9058       -1     
+ Misses       1035     1032       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EdamAme-x
Copy link
Contributor Author

EdamAme-x commented Nov 3, 2024

Unrelated, but I also added the missing test

WebSocketPair's mock is incomplete, so it is slightly hardcoded.

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

yusukebe commented Nov 3, 2024

@EdamAme-x

Changing the type definition is a good idea! Thank you.

@yusukebe yusukebe merged commit 6b9fb24 into honojs:main Nov 3, 2024
16 checks passed
TinsFox pushed a commit to TinsFox/hono that referenced this pull request Nov 11, 2024
…onojs#3616)

* fix(helper/websocket): allow custom events to be passed to generics

* chore: disable any

* add tests

* patch

* test patch
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.

The onOpen method of upgradeWebSocket cannot be triggered
2 participants