no-slash-collection-root-under-prefix
A collection-root route under a literal router prefix uses an empty path instead of a slash.
Why
With APIRouter(prefix="/items"), a "/" route serves /items/, so a caller of /items gets a 307 redirect. Some API clients do not follow it, or replay it without the body or authorization header.
Fix
Register the collection root with path "" so /items is served directly.
Examples
from fastapi import APIRouter
router = APIRouter(prefix="/tasks")
@router.get("/")async def list_tasks() -> list[str]: return []from fastapi import APIRouter
router = APIRouter(prefix="/tasks")
@router.get("")async def list_tasks() -> list[str]: return []