audreyfeldroy · GitHub

and others added 2 commits

March 13, 2026 09:05
StaticRewriteMiddleware.__call__ now uses `return await self.app()`
on both code paths. Frameworks like Starlette, FastAPI, and Air
rely on return values propagating through the middleware stack when
using app.add_middleware(). A bare `await` without `return` silently
discards the result.
Co-authored-by: Daniel Roy Greenfeld <pydanny@users.noreply.github.com>
The ASGI spec is silent on return type, but Starlette and other
frameworks define ASGIApp as Awaitable[Any] because middleware
chains propagate return values via `return await self.app(...)`.
Widening from Awaitable[None] lets ty accept inner apps that
return non-None values, which is what the return-value propagation
tests exercise.
Also applies ruff formatting (import ordering, dict literal style)
to both files.

@pydanny

Closed

Read the original on github.com ↗