You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visit http://127.0.0.1:4321/, then execute new WebSocket('ws://127.0.0.1:4321/foo') in browser console.
This error will be thrown:
Traceback (most recent call last):
File "handle_request", line 83, in handle_request
)
File "C:\Users\xmcp\AppData\Roaming\Python\Python38\site-packages\sanic\app.py", line 1002, in _websocket_handler
fut = ensure_future(handler(request, ws, *args, **kwargs))
TypeError: handler() missing 1 required positional argument: 'foo'
Expected behavior
It should not throw an error.
Environment (please complete the following information):
OS: Windows 10 (19044.1466)
Browser: not related
Version: sanic 21.12.1, sanic-ext 22.1.2
Additional context
Sanic wraps a functools.partial to the websocket handler, effectively erasing the type signature of the handler function. Therefore sanic_ext.extensions.injection.injector (screenshot below) cannot get its type hint:
The text was updated successfully, but these errors were encountered:
Describe the bug
Sanic-Ext fails to inject dependencies to
@app.websocket()
handlers.Screenshots
To Reproduce
Try this code:
Visit
http://127.0.0.1:4321/
, then executenew WebSocket('ws://127.0.0.1:4321/foo')
in browser console.This error will be thrown:
Expected behavior
It should not throw an error.
Environment (please complete the following information):
Additional context
Sanic wraps a
functools.partial
to the websocket handler, effectively erasing the type signature of the handler function. Thereforesanic_ext.extensions.injection.injector
(screenshot below) cannot get its type hint:The text was updated successfully, but these errors were encountered: