Add version parameter to websocket routes (#1760)

* Add version parameter to websockets

* Run black and cleanup code
This commit is contained in:
Adam Hopkins
2020-06-28 09:17:18 +03:00
committed by GitHub
parent 6239fa4f56
commit 6c8e20a859
2 changed files with 23 additions and 1 deletions

View File

@@ -462,7 +462,13 @@ class Sanic:
# Decorator
def websocket(
self, uri, host=None, strict_slashes=None, subprotocols=None, name=None
self,
uri,
host=None,
strict_slashes=None,
subprotocols=None,
version=None,
name=None,
):
"""
Decorate a function to be registered as a websocket route
@@ -536,6 +542,7 @@ class Sanic:
methods=frozenset({"GET"}),
host=host,
strict_slashes=strict_slashes,
version=version,
name=name,
)
)
@@ -550,6 +557,7 @@ class Sanic:
host=None,
strict_slashes=None,
subprotocols=None,
version=None,
name=None,
):
"""
@@ -577,6 +585,7 @@ class Sanic:
host=host,
strict_slashes=strict_slashes,
subprotocols=subprotocols,
version=version,
name=name,
)(handler)