fix check to skip session validation for stateless mode

This commit is contained in:
ihrpr 2025-04-21 14:56:12 +01:00
commit 37fc7d2ca8
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -288,7 +288,7 @@ describe("StreamableHTTPServerTransport", () => {
});
});
it("should reject requests without a valid session ID", async () => {
it.only("should reject requests without a valid session ID", async () => {
const response = await sendPostRequest(baseUrl, TEST_MESSAGES.toolsList);
expect(response.status).toBe(400);

View file

@ -463,8 +463,8 @@ export class StreamableHTTPServerTransport implements Transport {
* Returns true if the session is valid, false otherwise
*/
private validateSession(req: IncomingMessage, res: ServerResponse): boolean {
if (this.sessionId === undefined) {
// If the session ID is not set, the session management is disabled
if (this.sessionIdGenerator === undefined) {
// If the sessionIdGenerator ID is not set, the session management is disabled
// and we don't need to validate the session ID
return true;
}