Browse Source

Fix: propagate Mount routes in include_router

pull/14984/head
Felipe Carvajal 5 months ago
parent
commit
33ee724f31
  1. 2
      fastapi/routing.py
  2. 2
      tests/test_router_mount.py

2
fastapi/routing.py

@ -1550,7 +1550,7 @@ class APIRouter(routing.Router):
prefix + route.path, route.endpoint, name=route.name
)
elif isinstance(route, routing.Mount):
self.mount(prefix + route.path, route.app, route.name)
self.mount(prefix + router.prefix + route.path, route.app, name=route.name)
for handler in router.on_startup:
self.add_event_handler("startup", handler)

2
tests/test_router_mount.py

@ -1,4 +1,4 @@
from fastapi import APIRouter, FastAPI
from fastapi import FastAPI, APIRouter
from fastapi.testclient import TestClient

Loading…
Cancel
Save