Performance: Trailing slash behavior
MEDIUM IMPACT
This affects the routing and request handling speed, impacting how quickly the server responds and the browser renders the page.
from fastapi import FastAPI app = FastAPI() @app.get("/items/") async def read_items(): return {"message": "With trailing slash"}
from fastapi import FastAPI app = FastAPI() @app.get("/items") async def read_items(): return {"message": "No trailing slash"}
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Route without trailing slash, request with slash | N/A | N/A | N/A | [X] Bad - causes redirect delay |
| Route with trailing slash, request with slash | N/A | N/A | N/A | [OK] Good - direct response, no redirect |