Skip to content

Commit 0058c30

Browse files
qikaigaocliffhall
andauthored
Update src/server/streamableHttp.ts
Co-authored-by: Cliff Hall <[email protected]>
1 parent d88308b commit 0058c30

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/server/streamableHttp.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,12 @@ export class StreamableHTTPServerTransport implements Transport {
463463
* Returns true if the session is valid, false otherwise
464464
*/
465465
private validateSession(req: IncomingMessage, res: ServerResponse): boolean {
466-
if (this.sessionId && !this._initialized) {
466+
if (this.sessionId === undefined) {
467+
// If the session ID is not set, the session management is disabled
468+
// and we don't need to validate the session ID
469+
return true;
470+
}
471+
if (!this._initialized) {
467472
// If the server has not been initialized yet, reject all requests
468473
res.writeHead(400).end(JSON.stringify({
469474
jsonrpc: "2.0",

0 commit comments

Comments
 (0)