test: add tests for non-2xx HTTP status handling (fixes #3091) - #3093
test: add tests for non-2xx HTTP status handling (fixes #3091)#3093zsxh1990 wants to merge 7 commits into
Conversation
…rotocol#3091) Verify that StreamableHTTPTransport._handle_post_request properly handles 401/403/5xx by sending JSONRPCError to the caller instead of letting the request timeout. Tests: - 401 → JSONRPCError with INTERNAL_ERROR code - 403 → JSONRPCError with INTERNAL_ERROR code - 500 → JSONRPCError with INTERNAL_ERROR code - JSON error body → parsed and used directly Closes modelcontextprotocol#3091
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- SessionMessage is in mcp.shared.message, not mcp_types - Format with ruff
Use StreamableHTTPTransport(url) instead of __new__() to avoid AttributeError on uninitialized attributes.
ctx.client needs to be MagicMock (not AsyncMock) because stream() returns an async context manager, not a coroutine.
|
Hi team — friendly ping on this PR 🙂 CI is fully green (28/28 checks pass) and the Cubic AI reviewer has approved. This adds test coverage for non-2xx HTTP status handling (fixes #3091). Happy to adjust if needed. Thanks! |
|
Hi team — another friendly ping 🙂 This PR has been open for ~6 weeks now. CI is fully green (28/28 checks) and adds test coverage for non-2xx HTTP status handling (fixes #3091). Is there anything I can do to help move this forward? Happy to rebase or address any feedback. Thanks! |
|
Closing — PR has been open for 6 weeks with 2 pings and no review feedback. Happy to reopen if there's interest. |
Summary
Add tests verifying that
StreamableHTTPTransport._handle_post_requestproperly handles non-2xx HTTP status codes.Tests Added
Verification
The current implementation already handles non-2xx correctly (lines 342-373 in
streamable_http.py). These tests document the expected behavior and prevent regressions.Key Behavior
JSONRPCErrorsent to caller with original request IDINTERNAL_ERRORCloses #3091
/claim #3091