Merge pull request #1157 from kinware/feature/add-route-streams

Allow streaming handlers in app.add_route()
This commit is contained in:
Raphael Deem 2018-03-13 00:08:25 -07:00 committed by GitHub
commit cc84005593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,7 +220,7 @@ class Sanic:
name=name)
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
functions as a handler to the application url
routes.
@ -233,9 +233,9 @@ class Sanic:
:param strict_slashes:
:param version:
: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
"""
stream = False
# Handle HTTPMethodView differently
if hasattr(handler, 'view_class'):
methods = set()