We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28d6472 commit 8053869Copy full SHA for 8053869
1 file changed
examples/fastapi/app.py
@@ -13,7 +13,7 @@
13
14
import uvicorn
15
from fastapi import FastAPI
16
-from fastapi.responses import HTMLResponse
+from fastapi.responses import HTMLResponse, StreamingResponse
17
18
from datastar_py.fastapi import (
19
DatastarResponse,
@@ -59,7 +59,7 @@
59
"""
60
61
62
-@app.get("/")
+@app.get("/", response_class=HTMLResponse)
63
async def read_root():
64
return HTMLResponse(HTML.replace("CURRENT_TIME", f"{datetime.isoformat(datetime.now())}"))
65
@@ -76,7 +76,7 @@ async def time_updates():
76
await asyncio.sleep(1)
77
78
79
-@app.get("/updates")
+@app.get("/updates", response_class=StreamingResponse)
80
async def updates(signals: ReadSignals):
81
# ReadSignals is a dependency that automatically loads the signals from the request
82
print(signals)
0 commit comments