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

Function appOf

packages/server/test/terminals.e2e.test.ts:53–74  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected