fix(signal): report receive websocket pre-open closes · openclaw/openclaw@259f071
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -183,6 +183,19 @@ describe("containerCheck", () => {
|
183 | 183 | error: "Signal container receive endpoint did not upgrade to WebSocket (HTTP 200)", |
184 | 184 | }); |
185 | 185 | }); |
| 186 | + |
| 187 | +it("rejects container receive endpoints that close before opening", async () => { |
| 188 | +wsMockState.behavior = "close"; |
| 189 | +mockFetch.mockResolvedValue({ ok: true, status: 200 }); |
| 190 | + |
| 191 | +const result = await containerCheck("http://localhost:8080", 1000, "+14259798283"); |
| 192 | + |
| 193 | +expect(result).toEqual({ |
| 194 | +ok: false, |
| 195 | +status: null, |
| 196 | +error: "Signal container receive WebSocket closed before open (1000: done)", |
| 197 | +}); |
| 198 | +}); |
186 | 199 | }); |
187 | 200 | |
188 | 201 | describe("containerRestRequest", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -193,6 +193,14 @@ function containerReceiveCheck(
|
193 | 193 | error: err instanceof Error ? err.message : String(err), |
194 | 194 | }); |
195 | 195 | }); |
| 196 | +ws.once("close", (code, reason) => { |
| 197 | +const reasonText = reason.length > 0 ? `: ${reason.toString("utf8")}` : ""; |
| 198 | +settle({ |
| 199 | +ok: false, |
| 200 | +status: null, |
| 201 | +error: `Signal container receive WebSocket closed before open (${code}${reasonText})`, |
| 202 | +}); |
| 203 | +}); |
196 | 204 | }); |
197 | 205 | } |
198 | 206 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。