Skip to content

Commit 675354a

Browse files
authored
fix: jsonrpc client send streaming request header and timeout field (#475)
The underlying `aconnect_sse` library will overwrite the header and timeout of what's set in the `httpx_client`. From a user using adk `a2a_remote_agent` library, they would pass in these information in the `httpx_client`. I have tried this fix in my local setup.
1 parent 5342ca4 commit 675354a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/a2a/client/transports/jsonrpc.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ async def send_message_streaming(
147147
context,
148148
)
149149

150-
modified_kwargs.setdefault('timeout', None)
150+
modified_kwargs.setdefault(
151+
'timeout', self.httpx_client.timeout.as_dict().get('read', None)
152+
)
153+
headers = dict(self.httpx_client.headers.items())
154+
headers.update(modified_kwargs.get('headers', {}))
155+
modified_kwargs['headers'] = headers
151156

152157
async with aconnect_sse(
153158
self.httpx_client,

0 commit comments

Comments
 (0)