mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Correct use of middleware async handling. (#12078)
This commit is contained in:
parent
424fe95ce4
commit
40af9f2676
@ -23,7 +23,7 @@ def auth_middleware(request, handler):
|
||||
# If no password set, just always set authenticated=True
|
||||
if request.app['hass'].http.api_password is None:
|
||||
request[KEY_AUTHENTICATED] = True
|
||||
return handler(request)
|
||||
return (yield from handler(request))
|
||||
|
||||
# Check authentication
|
||||
authenticated = False
|
||||
@ -46,7 +46,7 @@ def auth_middleware(request, handler):
|
||||
authenticated = True
|
||||
|
||||
request[KEY_AUTHENTICATED] = authenticated
|
||||
return handler(request)
|
||||
return (yield from handler(request))
|
||||
|
||||
|
||||
def is_trusted_ip(request):
|
||||
|
@ -67,7 +67,7 @@ def staticresource_middleware(request, handler):
|
||||
"""Middleware to strip out fingerprint from fingerprinted assets."""
|
||||
path = request.path
|
||||
if not path.startswith('/static/') and not path.startswith('/frontend'):
|
||||
return handler(request)
|
||||
return (yield from handler(request))
|
||||
|
||||
fingerprinted = _FINGERPRINT.match(request.match_info['filename'])
|
||||
|
||||
@ -75,4 +75,4 @@ def staticresource_middleware(request, handler):
|
||||
request.match_info['filename'] = \
|
||||
'{}.{}'.format(*fingerprinted.groups())
|
||||
|
||||
return handler(request)
|
||||
return (yield from handler(request))
|
||||
|
Loading…
x
Reference in New Issue
Block a user