Debian Codegraph @

docs/examples/responses/json_suffix_responses.py

raw
1 from typing import Any, Dict
2
3 import litestar.status_codes
4 from litestar import Litestar, get
5
6
7 @get(
8 "/resources",
9 status_code=litestar.status_codes.HTTP_418_IM_A_TEAPOT,
10 media_type="application/vnd.example.resource+json",
11 )
12 async def retrieve_resource() -> Dict[str, Any]:
13 return {
14 "title": "Server thinks it is a teapot",
15 "type": "Server delusion",
16 "status": litestar.status_codes.HTTP_418_IM_A_TEAPOT,
17 }
18
19
20 app = Litestar(route_handlers=[retrieve_resource])