Skip empty SSE data to avoid parsing errors (#1670)
This commit is contained in:
parent
02b7889929
commit
5983a650cc
1 changed files with 32 additions and 2 deletions
|
|
@ -160,6 +160,9 @@ class StreamableHTTPTransport:
|
|||
) -> bool:
|
||||
"""Handle an SSE event, returning True if the response is complete."""
|
||||
if sse.event == "message":
|
||||
# Skip empty data (keep-alive pings)
|
||||
if not sse.data:
|
||||
return False
|
||||
try:
|
||||
message = JSONRPCMessage.model_validate_json(sse.data)
|
||||
logger.debug(f"SSE message: {message}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue