ASGI mounted at base root ("/") intercepts dynamic path params.
As explained by @peterschutt
peterschutt/sqladmin-litestar-plugin#11 (comment)
No response
from litestar import Litestar, asgi, get
from litestar.types.asgi_types import Receive, Scope, Send
@get("/")
async def home() -> str:
return "Hello, world!"
@asgi("/", is_mount=True)
async def mounted(scope: Scope, receive: Receive, send: Send) -> None:
await send({"type": "http.response.start", "status": 200})
await send({"type": "http.response.body", "body": b"Mounted!"})
@get("/dynamic/{name:int}")
async def dynamic(name: int) -> str:
return f"Hello, {name}!"
@get("/not_dynamic")
async def not_dynamic() -> str:
return "Hello, there!"
app = Litestar([home, dynamic, not_dynamic, mounted])
1. check not_dynamic or / routes
2. It has no problem
3. /dynamic/test
4. See error
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
No response
2.8.2
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too