FastAPI 0.138.2 patches frontend() to return proper 404s
Tiangolo's latest FastAPI patch refines static file serving with a critical bug fix.
FastAPI, the popular Python web framework with 99.8k GitHub stars, received a minor but meaningful patch release (0.138.2) from its creator Sebastián Ramírez (tiangolo). The headline change is a fix to the `app.frontend()` method: it now correctly returns a 404 status code for HTTP methods other than GET or HEAD when no static file matches. Previously, the behavior was inconsistent, potentially returning error pages or unclear responses. This aligns FastAPI with standard HTTP semantics and helps developers build more predictable static file serving in their APIs.
Beyond the bug fix, the release includes two internal improvements. The sponsors list was updated to remove Stainless, a reflection of FastAPI's evolving funding ecosystem. Additionally, the code handling sponsor banners was refactored (PR #15852) for better maintainability. While not user-facing, these changes show tiangolo's ongoing commitment to code quality and community structure. For a framework used in production by thousands of companies, even small patches matter for reliability and developer experience.
- app.frontend() now returns 404 for non-GET/HEAD methods without matching static files (PR #15863)
- Sponsor Stainless removed from list; sponsor banner handling refactored for maintainability (PR #15862, #15852)
- Release signed with verified GPG key, highlighting FastAPI's security focus
Why It Matters
Clean HTTP semantics for static file endpoints reduce debugging time for FastAPI developers in production.