Spaces:
Running
Running
Integrate request body size limit middleware
Browse files
main.py
CHANGED
|
@@ -35,6 +35,7 @@ from app.copilot import api as copilot
|
|
| 35 |
from app.core.config import Settings, get_settings
|
| 36 |
from app.core.exceptions import MediaAPIError
|
| 37 |
from app.core.logger import configure_logging, get_logger, request_id_context
|
|
|
|
| 38 |
from app.core.response import ErrorBody, ErrorResponse
|
| 39 |
from app.mcp.server import create_mcp_server
|
| 40 |
from app.projects import api as projects
|
|
@@ -138,6 +139,10 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
| 138 |
rate_limiter=container.rate_limiter,
|
| 139 |
audit=container.audit,
|
| 140 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
if active_settings.allowed_cors_origins:
|
| 142 |
application.add_middleware(
|
| 143 |
CORSMiddleware,
|
|
|
|
| 35 |
from app.core.config import Settings, get_settings
|
| 36 |
from app.core.exceptions import MediaAPIError
|
| 37 |
from app.core.logger import configure_logging, get_logger, request_id_context
|
| 38 |
+
from app.core.request_limits import RequestBodyLimitMiddleware
|
| 39 |
from app.core.response import ErrorBody, ErrorResponse
|
| 40 |
from app.mcp.server import create_mcp_server
|
| 41 |
from app.projects import api as projects
|
|
|
|
| 139 |
rate_limiter=container.rate_limiter,
|
| 140 |
audit=container.audit,
|
| 141 |
)
|
| 142 |
+
application.add_middleware(
|
| 143 |
+
RequestBodyLimitMiddleware,
|
| 144 |
+
max_bytes=active_settings.max_upload_size,
|
| 145 |
+
)
|
| 146 |
if active_settings.allowed_cors_origins:
|
| 147 |
application.add_middleware(
|
| 148 |
CORSMiddleware,
|