Files
fastapi/docs/tutorial/src/custom-response/tutorial002.py
Sebastián Ramírez f6667ecfb0 📝 Add docs for custom response
2018-12-15 15:20:22 +04:00

19 lines
352 B
Python

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>
"""