mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-12 05:26:45 +00:00
parent
f7f17fcfd6
commit
e71636e381
1 changed files with 4 additions and 2 deletions
|
|
@ -449,9 +449,11 @@ class APIRouter(routing.Router):
|
||||||
), "A path prefix must not end with '/', as the routes will start with '/'"
|
), "A path prefix must not end with '/', as the routes will start with '/'"
|
||||||
else:
|
else:
|
||||||
for r in router.routes:
|
for r in router.routes:
|
||||||
if not r.path:
|
path = getattr(r, "path")
|
||||||
|
name = getattr(r, "name", "unknown")
|
||||||
|
if path is not None and not path:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"Prefix and path cannot be both empty (operation: {r.name})"
|
f"Prefix and path cannot be both empty (path operation: {name})"
|
||||||
)
|
)
|
||||||
if responses is None:
|
if responses is None:
|
||||||
responses = {}
|
responses = {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue