Skip to content

Commit 6335cf4

Browse files
chore: restore original getReader() line placement in tests
1 parent b6a09f1 commit 6335cf4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/server/streamableHttp.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,8 +1341,6 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
13411341
expect(sseResponse.status).toBe(200);
13421342
expect(sseResponse.headers.get('content-type')).toBe('text/event-stream');
13431343

1344-
const reader = sseResponse.body?.getReader();
1345-
13461344
// Send a notification that should be stored with an event ID
13471345
const notification: JSONRPCMessage = {
13481346
jsonrpc: '2.0',
@@ -1354,6 +1352,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
13541352
await transport.send(notification);
13551353

13561354
// Read from the stream and verify we got the notification with an event ID
1355+
const reader = sseResponse.body?.getReader();
13571356
const { value } = await reader!.read();
13581357
const text = new TextDecoder().decode(value);
13591358

@@ -1385,12 +1384,11 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
13851384
});
13861385
expect(sseResponse.status).toBe(200);
13871386

1388-
const reader = sseResponse.body?.getReader();
1389-
13901387
// Send a server notification through the MCP server
13911388
await mcpServer.server.sendLoggingMessage({ level: 'info', data: 'First notification from MCP server' });
13921389

13931390
// Read the notification from the SSE stream
1391+
const reader = sseResponse.body?.getReader();
13941392
const { value } = await reader!.read();
13951393
const text = new TextDecoder().decode(value);
13961394

0 commit comments

Comments
 (0)