Skip to content

Commit b049719

Browse files
committed
Update examples
1 parent 088a9f7 commit b049719

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

examples/cos/cos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Agent {
122122

123123
let result = this.handle(msg);
124124

125-
const replyAddr = msg.reply? msg.reply.address : undefined;
125+
const replyAddr = msg.reply? msg.reply.address : undefined;
126126
if (!replyAddr) {
127127
return
128128
}

examples/ping-pong/http_runtime_server.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import AsyncIterator
33

44
from starlette.applications import Starlette
5+
from starlette.requests import Request
56
from starlette.responses import Response, JSONResponse
67
from starlette.routing import Route
78
from 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

Comments
 (0)