Skip to content

Commit

Permalink
[FIX] fastapi: update loading of middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
renda-dev committed Feb 27, 2024
1 parent d87a299 commit 5651e53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fastapi/models/fastapi_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def _get_app(self) -> FastAPI:
app = FastAPI(**self._prepare_fastapi_app_params())
for router in self._get_fastapi_routers():
app.include_router(router=router)
for middleware, options in self._get_fastapi_app_middlewares():
app.add_middleware(middleware, **options)
app.dependency_overrides[dependencies.fastapi_endpoint_id] = partial(
lambda a: a, self.id
)
Expand Down Expand Up @@ -258,7 +260,6 @@ def _prepare_fastapi_app_params(self) -> Dict[str, Any]:
return {
"title": self.name,
"description": self.description,
"middleware": self._get_fastapi_app_middlewares(),
"dependencies": self._get_fastapi_app_dependencies(),
}

Expand Down

0 comments on commit 5651e53

Please sign in to comment.