mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-07 08:35:52 -04:00
📝 Add docs for custom response
This commit is contained in:
18
docs/tutorial/src/custom-response/tutorial002.py
Normal file
18
docs/tutorial/src/custom-response/tutorial002.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import FastAPI
|
||||
from starlette.responses import HTMLResponse
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/", content_type=HTMLResponse)
|
||||
async def read_items():
|
||||
return """
|
||||
<html>
|
||||
<head>
|
||||
<title>Some HTML in here</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Look ma! HTML!</h1>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
Reference in New Issue
Block a user