MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / appOf

Function appOf

packages/server/test/ws-terminal.e2e.test.ts:55–76  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

53}
54
55function appOf(r: RunningServer): {
56 inject: (req: unknown) => Promise<{ statusCode: number; json: () => unknown }>;
57} {
58 const app = r.services.invokeFunction((a) => {
59 const gw = a.get(IRestGateway);
60 return gw.app as unknown as {
61 inject: (req: unknown) => Promise<{ statusCode: number; json: () => unknown }>;
62};
63 });
64 // Auto-attach the fixed bearer token so the M5.1 auth hook passes. A
65 // caller-supplied `authorization` header wins, so explicit token tests keep
66 // working; every other header (Range, content-type, …) is preserved.
67 return {
68 inject(req: unknown) {
69 const q = req as { headers?: Record<string, string | string[] | undefined> };
70 return app.inject({
71 ...q,
72 headers: { authorization: 'Bearer test-token', ...q.headers },
73 });
74 },
75 };
76}
77
78function envelopeOf<T>(body: unknown): {
79 code: number;

Callers 2

createSessionFunction · 0.70
createTerminalFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected