mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-23 19:03:07 +00:00
fix: address code review - add spec-compliance comment and mixed-batch test
- Document design choice: !('id' in msg) is strict per JSON-RPC 2.0 §4.1
- Add test: mixed batch (notification + request) with stale session → 400
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1287,5 +1287,21 @@ describe('HTTP Server Session Management', () => {
|
||||
|
||||
expect(res.status).toHaveBeenCalledWith(400);
|
||||
});
|
||||
|
||||
it('should return 400 for mixed batch (notification + request) with stale session', async () => {
|
||||
server = new SingleSessionHTTPServer();
|
||||
|
||||
const { req, res } = createMockReqRes();
|
||||
req.headers = { 'mcp-session-id': 'stale-session-that-does-not-exist' };
|
||||
req.method = 'POST';
|
||||
req.body = [
|
||||
{ jsonrpc: '2.0', method: 'notifications/initialized' },
|
||||
{ jsonrpc: '2.0', method: 'tools/list', id: 1 },
|
||||
];
|
||||
|
||||
await server.handleRequest(req as any, res as any);
|
||||
|
||||
expect(res.status).toHaveBeenCalledWith(400);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user