mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 13:34:17 +02:00
Merge pull request #357 from jlowin/middleware
Always apply request context middleware
This commit is contained in:
commit
17ec430095
1 changed files with 3 additions and 1 deletions
|
|
@ -728,7 +728,7 @@ class FastMCP(Generic[LifespanResultT]):
|
|||
# timeout to make it possible to close immediately. see
|
||||
# https://github.com/jlowin/fastmcp/issues/296
|
||||
uvicorn_config.setdefault("timeout_graceful_shutdown", 0)
|
||||
app = RequestContextMiddleware(self.sse_app())
|
||||
app = self.sse_app()
|
||||
|
||||
config = uvicorn.Config(
|
||||
app,
|
||||
|
|
@ -837,6 +837,8 @@ class FastMCP(Generic[LifespanResultT]):
|
|||
# mount these routes last, so they have the lowest route matching precedence
|
||||
routes.extend(self._custom_starlette_routes)
|
||||
|
||||
middleware.append(Middleware(RequestContextMiddleware))
|
||||
|
||||
# Create Starlette app with routes and middleware
|
||||
return Starlette(
|
||||
debug=self.settings.debug, routes=routes, middleware=middleware
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue