Skip to content

Commit

Permalink
fix: ignore redoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Selflocking committed Jan 22, 2024
1 parent 34d13f3 commit f31d396
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@


@app.middleware("http")
async def add_static_filter(request: Request, call_next):
async def static_filter(request: Request, call_next):
urlpath = request.url.path
# 如果是 fastapi 相关的路由,直接返回
if (
urlpath.startswith("/api")
or urlpath.startswith("/docs")
or urlpath.startswith("/redoc")
or urlpath == "/openapi.json"
):
return await call_next(request)
Expand Down
1 change: 1 addition & 0 deletions src/backend/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def wrapper(*args, **kwargs):

# FastAPI Dependency
def get_session():
# 获得一个 session
session = db.ScopedSession()
try:
yield session
Expand Down

0 comments on commit f31d396

Please sign in to comment.