Add ability for app.static() to return the routes it created. (#1954)

This allows blueprint registration to add the bp's static routes to its list of own routes. So now blueprint middlewares will apply to a blueprint's static file routes.
Fixes #1953
This commit is contained in:
Ashley Sommer
2020-10-25 05:57:02 +10:00
committed by GitHub
parent 5928c50057
commit fb3d368a78
4 changed files with 48 additions and 11 deletions

View File

@@ -676,9 +676,10 @@ class Sanic:
:param strict_slashes: Instruct :class:`Sanic` to check if the request
URLs need to terminate with a */*
:param content_type: user defined content type for header
:return: None
:return: routes registered on the router
:rtype: List[sanic.router.Route]
"""
static_register(
return static_register(
self,
uri,
file_or_directory,