feat: 自定义的拦截器需要在跨域拦截器之前添加,否则会出现跨域不生效的问题

This commit is contained in:
martsforever
2025-08-22 16:00:17 +08:00
parent 3127659fe3
commit 8387dc38c3
3 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ def add_app_middlewares(app: FastAPI):
response = await call_next(request)
except HTTPException as e:
if e.status_code == status.HTTP_401_UNAUTHORIZED:
return JSONResponse(content=e.detail, status_code=status.HTTP_401_UNAUTHORIZED)
return JSONResponse(content={"message": e.detail}, status_code=status.HTTP_401_UNAUTHORIZED)
else:
raise e
return response