From a36ae315b0aeda46c4686f41eeb821e2d96768ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 20 Sep 2025 15:23:37 +0800 Subject: [PATCH] Fix useStream variable scope in HTTP server adapter Moved the declaration of useStream inside the action check to prevent referencing it when action is undefined. --- src/onebot/network/http-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebot/network/http-server.ts b/src/onebot/network/http-server.ts index c4a2f3dc..e6a49323 100644 --- a/src/onebot/network/http-server.ts +++ b/src/onebot/network/http-server.ts @@ -121,8 +121,8 @@ export class OB11HttpServerAdapter extends IOB11NetworkAdapter const real_echo = payload_echo ?? Math.random().toString(36).substring(2, 15); // eslint-disable-next-line @typescript-eslint/no-explicit-any const action = this.actions.get(actionName as any); - const useStream = action.useStream; if (action) { + const useStream = action.useStream; try { const result = await action.handle(payload, this.name, this.config, { send: request_sse ? async (data: object) => {