Commit Graph

1 Commits

Author SHA1 Message Date
Jonathan Fulton b6412448bc fix: enable mounting sub-applications under APIRouter (#10180)
Added support for mounting sub-applications on APIRouter with proper
prefix handling:

1. Override mount() in APIRouter to automatically apply the router's
   prefix to the mount path

2. Handle Mount routes in include_router() to apply the include prefix

This allows patterns like:
    router = APIRouter(prefix='/api')
    router.mount('/subapp', FastAPI())
    app.include_router(router)

Which correctly routes requests to /api/subapp/...

Note: Mounts must be added before include_router() is called, as
include_router copies routes at call time. This is consistent with
how other routes work.

Fixes #10180
2026-01-31 19:14:23 -05:00