Remove or clause for sessionId where "none" is offered as an alternative.

In the first case (line 16) we already know that req.query.sessionId is set to something. I

 n the second (line 40), it doesn't matter because if it doesn't map to a transport no further action is taken.
This commit is contained in:
cliffhall
2025-05-28 16:31:21 -04:00
parent d297c51f5e
commit 2da9f33969

View File

@@ -13,7 +13,7 @@ app.get("/sse", async (req, res) => {
const { server, cleanup } = createServer();
if (req?.query?.sessionId) {
const sessionId = (req?.query?.sessionId as string) || "none";
const sessionId = (req?.query?.sessionId as string);
transport = transports.get(sessionId) as SSEServerTransport;
console.error("Client Reconnecting? This shouldn't happen; when client has a sessionId, GET /sse should not be called again.", transport.sessionId);
} else {
@@ -37,7 +37,7 @@ app.get("/sse", async (req, res) => {
});
app.post("/message", async (req, res) => {
const sessionId = (req?.query?.sessionId as string) || "none";
const sessionId = (req?.query?.sessionId as string);
const transport = transports.get(sessionId);
if (transport) {
console.error("Client Message from", sessionId);