Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/a2a/server/apps/jsonrpc/jsonrpc_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,39 @@

if TYPE_CHECKING:
from fastapi import FastAPI
from sse_starlette.sse import EventSourceResponse
from starlette.applications import Starlette
from starlette.authentication import BaseUser
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.status import HTTP_413_REQUEST_ENTITY_TOO_LARGE

try:
# Starlette v0.48.0
from starlette.status import HTTP_413_CONTENT_TOO_LARGE
except ImportError:
from starlette.status import ( # type: ignore[no-redef]

Check notice on line 72 in src/a2a/server/apps/jsonrpc/jsonrpc_app.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/server/apps/jsonrpc/jsonrpc_app.py (80-92)
HTTP_413_REQUEST_ENTITY_TOO_LARGE as HTTP_413_CONTENT_TOO_LARGE,
)

_package_starlette_installed = True
else:
FastAPI = Any
try:
from sse_starlette.sse import EventSourceResponse
from starlette.applications import Starlette
from starlette.authentication import BaseUser
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from starlette.status import HTTP_413_REQUEST_ENTITY_TOO_LARGE

try:
# Starlette v0.48.0
from starlette.status import HTTP_413_CONTENT_TOO_LARGE
except ImportError:
from starlette.status import (
HTTP_413_REQUEST_ENTITY_TOO_LARGE as HTTP_413_CONTENT_TOO_LARGE,

Check notice on line 92 in src/a2a/server/apps/jsonrpc/jsonrpc_app.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/server/apps/jsonrpc/jsonrpc_app.py (61-72)
)

_package_starlette_installed = True
except ImportError:
Expand All @@ -90,7 +104,7 @@
Request = Any
JSONResponse = Any
Response = Any
HTTP_413_REQUEST_ENTITY_TOO_LARGE = Any
HTTP_413_CONTENT_TOO_LARGE = Any


class StarletteUserProxy(A2AUser):
Expand Down Expand Up @@ -381,7 +395,7 @@
None, A2AError(root=JSONParseError(message=str(e)))
)
except HTTPException as e:
if e.status_code == HTTP_413_REQUEST_ENTITY_TOO_LARGE:
if e.status_code == HTTP_413_CONTENT_TOO_LARGE:
return self._generate_error_response(
request_id,
A2AError(
Expand Down
Loading