Clean up use cases:

This commit is contained in:
Adam Hopkins
2021-02-03 22:36:44 +02:00
parent 96cc49e31e
commit 3f1e9ff528
8 changed files with 56 additions and 21 deletions

View File

@@ -52,6 +52,8 @@ class RouteMixin:
of type :class:`FutureRoute`
"""
# TODO:
# - run when applying future, not here
if websocket:
self.enable_websocket()
@@ -83,6 +85,8 @@ class RouteMixin:
# variable will be a tuple of (existing routes, handler fn)
_, handler = handler
# TODO:
# - move websocket handler out and attach it when applying
if websocket:
websocket_handler = partial(
self._websocket_handler,
@@ -100,6 +104,11 @@ class RouteMixin:
# -
name = self._generate_name(handler, name)
if isinstance(host, str):
host = frozenset([host])
elif host and not isinstance(host, frozenset):
host = frozenset(host)
route = FutureRoute(
handler,
uri,