Repository navigation
Conversation
Fixes modelcontextprotocol#2661 The batch-response and notification-replay tests read the SSE stream once and assumed every event arrived in a single fetch chunk. On newer Node versions fetch can split the events across chunks, so the tests failed before the later events arrived. Add a readSSEUntil helper that keeps reading until the expected text appears (or a short timeout cancels the stream) and use it in the two affected tests.
|
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2661
The batch-response test (
should handle batch request messages with SSE stream for responses) and the notification-replay test (should store and replay MCP server tool notifications) inpackages/middleware/node/test/streamableHttp.test.tseach calledreader.read()once and assumed every SSE event arrived in a single fetch chunk. On newer Node versions fetch can deliver the events in separate chunks, so the tests failed before the later events arrived even though the middleware behaved correctly.This adds a
readSSEUntilhelper that keeps reading chunks until the accumulated text contains the expected event(s) (with a short timeout that cancels the stream so a missing event fails the test instead of hanging it), and uses it in the two affected tests. No production code is changed.Verified:
pnpm --filter @modelcontextprotocol/node test -- test/streamableHttp.test.ts: 105 passed (streamableHttp.test.ts: 75 passed)pnpm --filter @modelcontextprotocol/node check(typecheck + lint): pass