Skip to content

Commit

Permalink
Import lifespan as a middleware as per the change in starlette package
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnesayeed committed Nov 30, 2018
1 parent 4001a60 commit 1113a9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions responder/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from apispec.ext.marshmallow import MarshmallowPlugin
from asgiref.wsgi import WsgiToAsgi
from starlette.middleware.errors import ServerErrorMiddleware
from starlette.lifespan import LifespanHandler
from starlette.middleware.cors import CORSMiddleware
from starlette.middleware.gzip import GZipMiddleware
from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware
from starlette.middleware.lifespan import LifespanMiddleware
from starlette.middleware.trustedhost import TrustedHostMiddleware
from starlette.routing import Router
from starlette.staticfiles import StaticFiles
Expand Down Expand Up @@ -135,7 +135,7 @@ def __init__(

self.add_middleware(TrustedHostMiddleware, allowed_hosts=self.allowed_hosts)

self.lifespan_handler = LifespanHandler()
self.lifespan_handler = LifespanMiddleware(self.app)

if self.cors:
self.add_middleware(CORSMiddleware, **self.cors_params)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
sys.exit()

required = [
"starlette<0.9",
"starlette",
"uvicorn",
"aiofiles",
"pyyaml",
Expand Down

0 comments on commit 1113a9a

Please sign in to comment.