Skip to content

Commit 7b3e6d6

Browse files
committed
fixing linter
1 parent adb02cd commit 7b3e6d6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/a2a/server/apps/jsonrpc/jsonrpc_app.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
JSONRPCErrorResponse,
3636
JSONRPCRequest,
3737
JSONRPCResponse,
38-
MethodNotFoundError,
3938
ListTaskPushNotificationConfigRequest,
39+
MethodNotFoundError,
4040
SendMessageRequest,
4141
SendStreamingMessageRequest,
4242
SendStreamingMessageResponse,
@@ -91,6 +91,8 @@
9191
Response = Any
9292
HTTP_413_REQUEST_ENTITY_TOO_LARGE = Any
9393

94+
MAX_CONTENT_LENGTH = 1_000_000
95+
9496

9597
class StarletteUserProxy(A2AUser):
9698
"""Adapts the Starlette User class to the A2A user representation."""
@@ -271,13 +273,13 @@ async def _handle_requests(self, request: Request) -> Response: # noqa: PLR0911
271273
request_id = body.get('id')
272274
# Ensure request_id is valid for JSON-RPC response (str/int/None only)
273275
if request_id is not None and not isinstance(
274-
request_id, (str, int)
276+
request_id, str | int
275277
):
276278
request_id = None
277279
# Treat very large payloads as invalid request (-32600) before routing
278280
with contextlib.suppress(Exception):
279281
content_length = int(request.headers.get('content-length', '0'))
280-
if content_length and content_length > 1_000_000:
282+
if content_length and content_length > MAX_CONTENT_LENGTH:
281283
return self._generate_error_response(
282284
request_id,
283285
A2AError(

0 commit comments

Comments
 (0)