| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ssertionError (modelcontextprotocol#883) When Starlette's BaseHTTPMiddleware wraps the SSE endpoint, it expects http.response.body messages. However, the SSE handler sends raw ASGI events, causing 'AssertionError: Unexpected message'. Fix: Replace the Starlette endpoint wrapper (sse_endpoint function) with a callable ASGI class (HandleSseAsgi) so the SSE handler bypasses middleware response body wrapping. Also remove the unnecessary 'return Response()' from handle_sse since it's a raw ASGI callable. Closes modelcontextprotocol#883
|
Marking as draft until CI is fixed |
Sorry, something went wrong.
|
Thanks for the PR. Tracking this in #1222 instead. Closing this as part of a wider backlog cleanup following the v2 launch. Feel free to reopen if this is still relevant. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When Starlette's BaseHTTPMiddleware wraps the SSE endpoint, it expects http.response.body messages. However, the SSE handler sends raw ASGI events, causing 'AssertionError: Unexpected message'.
This PR fixes the issue by replacing the Starlette endpoint wrapper (sse_endpoint function) with a callable ASGI class (HandleSseAsgi). This ensures the SSE handler bypasses middleware response body wrapping, resolving the AssertionError.
Also removes the unnecessary 'return Response()' from handle_sse since it's a raw ASGI callable.
Closes #883