Uh oh!
There was an error while loading. Please reload this page.
Fixes Register Endpoint for Router of Instance of APIWebSocketRoute - #358
Fixes Register Endpoint for Router of Instance of APIWebSocketRoute#358HideyoshiNakazone wants to merge 4 commits into
Conversation
HideyoshiNakazone
commented
Feb 18, 2025
Hey @yuval9313, could you or another maintainer take a look in this merge request please? Thanks a lot, |
yuval9313
left a comment
There was a problem hiding this comment.
You are also missing test case
| for route in router.routes: | ||
| if not isinstance(route, APIRoute): | ||
| raise ValueError("The provided routes should be of type APIRoute") | ||
| if not isinstance(route, APIRoute) and not isinstance(route, APIWebSocketRoute): |
There was a problem hiding this comment.
I'm sorry, this is really nit pick but I prefer not (condition a or condition b)
There was a problem hiding this comment.
Not a problem at all, i'll happily make the change :)
Hello, I've added a test case in the unittests for the websocket example, it tests the three basic operations on the websocket connection (can accept connection, can send_text, receive_text and can close). I hope this test is okay :) |
kaziiriad
commented
May 30, 2025
HideyoshiNakazone
commented
Jul 21, 2025
Hello @yuval9313 , can we resume this MR? I'd love to have this merged |
Versions
Python Version: 3.13
Package Versions:
Bug
When creating a Route of type
APIWebSocketRoutethe following error is thrown:This error can be replicated using the following example:
Solution
The solution i recommend is to just add the class to instance check of the
_register_endpointsfunction and then add it with a fixedroute_methodof"WS"since theAPIWebSocketRoutedoes not have amethodsatribute.Thank you very much,
Vitor Hideyoshi.