Skip to content

Commit 2844c40

Browse files
committed
chore: address more comments
1 parent 444cb43 commit 2844c40

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/transports/streamableHttp.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const JSON_RPC_ERROR_CODE_SESSION_ID_INVALID = -32002;
1414
const JSON_RPC_ERROR_CODE_SESSION_NOT_FOUND = -32003;
1515
const JSON_RPC_ERROR_CODE_INVALID_REQUEST = -32004;
1616

17-
function promiseHandler(
17+
function withErrorHandling(
1818
fn: (req: express.Request, res: express.Response, next: express.NextFunction) => Promise<void>
1919
) {
2020
return (req: express.Request, res: express.Response, next: express.NextFunction) => {
@@ -88,7 +88,7 @@ export class StreamableHttpRunner extends TransportRunnerBase {
8888

8989
app.post(
9090
"/mcp",
91-
promiseHandler(async (req: express.Request, res: express.Response) => {
91+
withErrorHandling(async (req: express.Request, res: express.Response) => {
9292
const sessionId = req.headers["mcp-session-id"];
9393
if (sessionId) {
9494
await handleSessionRequest(req, res);
@@ -141,8 +141,8 @@ export class StreamableHttpRunner extends TransportRunnerBase {
141141
})
142142
);
143143

144-
app.get("/mcp", promiseHandler(handleSessionRequest));
145-
app.delete("/mcp", promiseHandler(handleSessionRequest));
144+
app.get("/mcp", withErrorHandling(handleSessionRequest));
145+
app.delete("/mcp", withErrorHandling(handleSessionRequest));
146146

147147
this.httpServer = await new Promise<http.Server>((resolve, reject) => {
148148
const result = app.listen(this.userConfig.httpPort, this.userConfig.httpHost, (err?: Error) => {

0 commit comments

Comments
 (0)