22from typing import AsyncIterator
33
44from starlette .applications import Starlette
5+ from starlette .requests import Request
56from starlette .responses import Response , JSONResponse
67from starlette .routing import Route
78from sse_starlette .sse import EventSourceResponse
@@ -25,13 +26,13 @@ async def shutdown():
2526 await backend .stop ()
2627
2728
28- async def publish (request ):
29+ async def publish (request : Request ):
2930 data : dict = await request .json ()
3031
3132 addr : Address = Address .model_validate (data ["addr" ])
3233 msg : RawMessage = RawMessage .model_validate (data ["msg" ])
3334 stream : bool = data .get ("stream" , False )
34- request : bool = data .get ("request" , False )
35+ _request : bool = data .get ("request" , False )
3536 reply : str = data .get ("reply" , "" )
3637 timeout : float = data .get ("timeout" , 0.5 )
3738 probe : bool = data .get ("probe" , True )
@@ -57,7 +58,7 @@ async def event_stream() -> AsyncIterator[str]:
5758 addr = addr ,
5859 msg = msg ,
5960 stream = stream ,
60- request = request ,
61+ request = _request ,
6162 reply = reply ,
6263 timeout = timeout ,
6364 probe = probe ,
@@ -71,7 +72,7 @@ async def event_stream() -> AsyncIterator[str]:
7172 return JSONResponse (resp .encode (mode = "json" ))
7273
7374
74- async def subscribe (request ):
75+ async def subscribe (request : Request ):
7576 data : dict = await request .json ()
7677 msgs : AsyncIterator [RawMessage ] = backend .subscribe (
7778 addr = Address .model_validate (data ["addr" ]),
@@ -85,7 +86,7 @@ async def event_stream() -> AsyncIterator[str]:
8586 return EventSourceResponse (event_stream ())
8687
8788
88- async def new_reply_topic (request ):
89+ async def new_reply_topic (request : Request ):
8990 topic = await backend .new_reply_topic ()
9091 return JSONResponse (dict (reply_topic = topic ))
9192
0 commit comments