Remove unnecessary prefix from websocket handler name (#2021)

Remove the websocket prefix "websocket_handler_" introduced in
761eef7. Add a backward support for url_for() calling with this prefix
in param "view_name".
This commit is contained in:
laggardkernel
2021-03-15 02:33:07 +08:00
committed by GitHub
parent 97635111af
commit 8d86c3c598
2 changed files with 30 additions and 3 deletions

View File

@@ -348,3 +348,13 @@ def test_methodview_naming(methodview_app):
assert viewone_url == "/view_one"
assert viewtwo_url == "/view_two"
def test_url_for_with_websocket_handlers(app):
# Test for a specific bugfix in GH-2021
@app.websocket("/ws")
async def my_handler(request, ws):
pass
assert app.url_for("my_handler") == "/ws"
assert app.url_for("websocket_handler_my_handler") == "/ws"