Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
5982cbe
1
Parent(s): ba6c66b
Claude Code: Fix Starlette middleware import - BaseMiddleware -> BaseHTTPMiddleware
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
| 2 |
import logging
|
| 3 |
import traceback
|
| 4 |
from fastapi import FastAPI, Request
|
| 5 |
-
from starlette.middleware.base import
|
| 6 |
from datetime import datetime
|
| 7 |
from fastapi.responses import JSONResponse
|
| 8 |
from pydantic import BaseModel
|
|
@@ -30,7 +30,7 @@ STARTUP_MODE = os.environ.get("STARTUP_MODE", "minimal")
|
|
| 30 |
app = FastAPI()
|
| 31 |
|
| 32 |
|
| 33 |
-
class LoggingMiddleware(
|
| 34 |
"""Middleware to log all requests and capture full tracebacks on errors."""
|
| 35 |
|
| 36 |
async def dispatch(self, request: Request, call_next):
|
|
|
|
| 2 |
import logging
|
| 3 |
import traceback
|
| 4 |
from fastapi import FastAPI, Request
|
| 5 |
+
from starlette.middleware.base import BaseHTTPMiddleware
|
| 6 |
from datetime import datetime
|
| 7 |
from fastapi.responses import JSONResponse
|
| 8 |
from pydantic import BaseModel
|
|
|
|
| 30 |
app = FastAPI()
|
| 31 |
|
| 32 |
|
| 33 |
+
class LoggingMiddleware(BaseHTTPMiddleware):
|
| 34 |
"""Middleware to log all requests and capture full tracebacks on errors."""
|
| 35 |
|
| 36 |
async def dispatch(self, request: Request, call_next):
|