






















@@ -1097,6 +1097,35 @@ describe("handleControlUiHttpRequest", () => {
10971097});
10981098});
109910991100+it("serves public root assets under the internal namespace when the SPA is routed there", async () => {
1101+await withControlUiRoot({
1102+fn: async (tmp) => {
1103+await fs.writeFile(path.join(tmp, "favicon.svg"), "<svg/>");
1104+await fs.writeFile(path.join(tmp, "manifest.webmanifest"), "{}");
1105+await fs.writeFile(path.join(tmp, "apple-touch-icon.png"), "png-bytes");
1106+await fs.writeFile(path.join(tmp, "sw.js"), "self.addEventListener('push', () => {});");
1107+1108+for (const [url, expectedType] of [
1109+["/__openclaw__/favicon.svg", "image/svg+xml"],
1110+["/__openclaw__/manifest.webmanifest", "application/manifest+json; charset=utf-8"],
1111+["/__openclaw__/apple-touch-icon.png", "image/png"],
1112+["/__openclaw__/sw.js", "application/javascript; charset=utf-8"],
1113+] as const) {
1114+const { res, end, handled } = await runControlUiRequest({
1115+ url,
1116+method: "GET",
1117+rootPath: tmp,
1118+});
1119+1120+expect(handled, `expected ${url} to be handled`).toBe(true);
1121+expect(res.statusCode, `expected ${url} to be served`).toBe(200);
1122+expect(res.setHeader).toHaveBeenCalledWith("Content-Type", expectedType);
1123+expect(end, `expected ${url} to write a body`).toHaveBeenCalled();
1124+}
1125+},
1126+});
1127+});
1128+11001129it("does not handle POST to root-mounted paths (plugin webhook passthrough)", async () => {
11011130await withControlUiRoot({
11021131fn: async (tmp) => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。