mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-21 09:25:25 -04:00
📝 Improve naming of middleware in SQLAlchemy tutorial
This commit is contained in:
1 parent
22f4e18cdd
commit
9051ec3816
2 files changed
+3
-1
No files matched your search
@@ -60,7 +60,7 @@ def read_user(request: Request, user_id: int):
|
||||
|
||||
|
||||
@app.middleware("http")
|
||||
async def close_db(request: Request, call_next):
|
||||
async def db_session_middleware(request: Request, call_next):
|
||||
request.state.db = Session()
|
||||
response = await call_next(request)
|
||||
request.state.db.close()
|
||||
|
||||
Reference in new issue
Block a user