mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-11 21:16:45 +00:00
📝 Update default error response in SQL tutorial
This commit is contained in:
parent
fad3a9e1dc
commit
37e0306517
1 changed files with 1 additions and 1 deletions
|
|
@ -67,7 +67,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
|
||||||
|
|
||||||
@app.middleware("http")
|
@app.middleware("http")
|
||||||
async def db_session_middleware(request: Request, call_next):
|
async def db_session_middleware(request: Request, call_next):
|
||||||
response = Response('', status_code=500)
|
response = Response("Internal server error", status_code=500)
|
||||||
try:
|
try:
|
||||||
request.state.db = SessionLocal()
|
request.state.db = SessionLocal()
|
||||||
response = await call_next(request)
|
response = await call_next(request)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue