Allow streaming handlers in add_route
This commit is contained in:
parent
44bc47361e
commit
915d2732a1
|
@ -220,7 +220,7 @@ class Sanic:
|
||||||
name=name)
|
name=name)
|
||||||
|
|
||||||
def add_route(self, handler, uri, methods=frozenset({'GET'}), host=None,
|
def add_route(self, handler, uri, methods=frozenset({'GET'}), host=None,
|
||||||
strict_slashes=None, version=None, name=None):
|
strict_slashes=None, version=None, name=None, stream=False):
|
||||||
"""A helper method to register class instance or
|
"""A helper method to register class instance or
|
||||||
functions as a handler to the application url
|
functions as a handler to the application url
|
||||||
routes.
|
routes.
|
||||||
|
@ -233,9 +233,9 @@ class Sanic:
|
||||||
:param strict_slashes:
|
:param strict_slashes:
|
||||||
:param version:
|
:param version:
|
||||||
:param name: user defined route name for url_for
|
:param name: user defined route name for url_for
|
||||||
|
:param stream: boolean specifying if the handler is a stream handler
|
||||||
:return: function or class instance
|
:return: function or class instance
|
||||||
"""
|
"""
|
||||||
stream = False
|
|
||||||
# Handle HTTPMethodView differently
|
# Handle HTTPMethodView differently
|
||||||
if hasattr(handler, 'view_class'):
|
if hasattr(handler, 'view_class'):
|
||||||
methods = set()
|
methods = set()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user