fix method ignore on websocket route

This commit is contained in:
Adam Hopkins 2021-02-02 01:07:29 +02:00
parent 94e5f82a81
commit 96cc49e31e

View File

@ -26,7 +26,7 @@ class RouteMixin:
def route(
self,
uri,
methods=frozenset({"GET"}),
methods=None,
host=None,
strict_slashes=None,
stream=False,
@ -63,6 +63,9 @@ class RouteMixin:
if strict_slashes is None:
strict_slashes = self.strict_slashes
if not methods and not websocket:
methods = frozenset({"GET"})
def decorator(handler):
nonlocal uri
nonlocal methods
@ -100,7 +103,7 @@ class RouteMixin:
route = FutureRoute(
handler,
uri,
frozenset([x.upper() for x in methods]),
None if websocket else frozenset([x.upper() for x in methods]),
host,
strict_slashes,
stream,