fix: parse http idle timeout strings strictly · openclaw/openclaw@d08bcb4
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { parseHttpIdleTimeoutMs } from "./http-dispatcher.js"; |
| 3 | + |
| 4 | +describe("parseHttpIdleTimeoutMs", () => { |
| 5 | +it("parses configured idle timeout strings", () => { |
| 6 | +expect(parseHttpIdleTimeoutMs("30000")).toBe(30_000); |
| 7 | +expect(parseHttpIdleTimeoutMs("disabled")).toBe(0); |
| 8 | +expect(parseHttpIdleTimeoutMs(" ")).toBeUndefined(); |
| 9 | +}); |
| 10 | + |
| 11 | +it("rejects non-decimal idle timeout strings", () => { |
| 12 | +expect(parseHttpIdleTimeoutMs("1e3")).toBeUndefined(); |
| 13 | +expect(parseHttpIdleTimeoutMs("0x10")).toBeUndefined(); |
| 14 | +}); |
| 15 | + |
| 16 | +it("preserves numeric idle timeout normalization", () => { |
| 17 | +expect(parseHttpIdleTimeoutMs(42.8)).toBe(42); |
| 18 | +expect(parseHttpIdleTimeoutMs(-1)).toBeUndefined(); |
| 19 | +}); |
| 20 | +}); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。