docs/examples/parameters/query_params_remap.py
raw| 1 | from typing import Dict |
| 2 | |
| 3 | from typing_extensions import Annotated |
| 4 | |
| 5 | from litestar import Litestar, get |
| 6 | from litestar.params import QueryParameter |
| 7 | |
| 8 | |
| 9 | @get("/", sync_to_thread=False) |
| 10 | def index(snake_case: Annotated[str, QueryParameter(name="camelCase")]) -> Dict[str, str]: |
| 11 | return {"param": snake_case} |
| 12 | |
| 13 | |
| 14 | app = Litestar(route_handlers=[index]) |
| 15 | |
| 16 | # run: /?camelCase=foo |