mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 05:56:18 +00:00
* Add embed rendering for Control UI assistant output * Add changelog entry for embed rendering * Harden canvas path resolution and stage isolation * Secure assistant media route and preserve UI avatar override * Fix chat media and history regressions * Harden embed iframe URL handling * Fix embed follow-up review regressions * Restore offloaded chat attachment persistence * Harden hook and media routing * Fix embed review follow-ups * feat(ui): add configurable embed sandbox mode * fix(gateway): harden assistant media and auth rotation * fix(gateway): restore websocket pairing handshake flows * fix(gateway): restore ws hello policy details * Restore dropped control UI shell wiring * Fix control UI reconnect cleanup regressions * fix(gateway): restore media root and auth getter compatibility * feat(ui): rename public canvas tag to embed * fix(ui): address remaining media and gateway review issues * fix(ui): address remaining embed and attachment review findings * fix(ui): restore stop control and tool card inputs * fix(ui): address history and attachment review findings * fix(ui): restore prompt contribution wiring * fix(ui): address latest history and directive reviews * fix(ui): forward password auth for assistant media * fix(ui): suppress silent transcript tokens with media * feat(ui): add granular embed sandbox modes * fix(ui): preserve relative media directives in history * docs(ui): document embed sandbox modes * fix(gateway): restrict canvas history hoisting to tool entries * fix(gateway): tighten embed follow-up review fixes * fix(ci): repair merged branch type drift * fix(prompt): restore stable runtime prompt rendering * fix(ui): harden local attachment preview checks * fix(prompt): restore channel-aware approval guidance * fix(gateway): enforce auth rotation and media cleanup * feat(ui): gate external embed urls behind config * fix(ci): repair rebased branch drift * fix(ci): resolve remaining branch check failures
27 lines
704 B
TypeScript
27 lines
704 B
TypeScript
import type { ServerResponse } from "node:http";
|
|
import { PassThrough } from "node:stream";
|
|
import { vi } from "vitest";
|
|
|
|
export function makeMockHttpResponse(): {
|
|
res: ServerResponse;
|
|
setHeader: ReturnType<typeof vi.fn>;
|
|
end: ReturnType<typeof vi.fn>;
|
|
} {
|
|
const stream = new PassThrough();
|
|
const streamEnd = stream.end.bind(stream);
|
|
const setHeader = vi.fn();
|
|
const end = vi.fn((chunk?: unknown) => {
|
|
if (chunk !== undefined) {
|
|
stream.write(chunk as string | Uint8Array);
|
|
}
|
|
streamEnd();
|
|
});
|
|
const res = Object.assign(stream, {
|
|
headersSent: false,
|
|
statusCode: 200,
|
|
setHeader,
|
|
end,
|
|
}) as unknown as ServerResponse;
|
|
return { res, setHeader, end };
|
|
}
|