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

Function appOf

packages/server/test/fs-watch.e2e.test.ts:89–116  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

87}
88
89function appOf(r: RunningServer): {
90 inject: (req: unknown) => Promise<{
91 statusCode: number;
92 json: () => unknown;
93 }>;
94} {
95 const app = r.services.invokeFunction((a) => {
96 const gw = a.get(IRestGateway);
97 return gw.app as unknown as {
98 inject: (req: unknown) => Promise<{
99 statusCode: number;
100 json: () => unknown;
101 }>;
102};
103 });
104 // Auto-attach the fixed bearer token so the M5.1 auth hook passes. A
105 // caller-supplied `authorization` header wins, so explicit token tests keep
106 // working; every other header (Range, content-type, …) is preserved.
107 return {
108 inject(req: unknown) {
109 const q = req as { headers?: Record<string, string | string[] | undefined> };
110 return app.inject({
111 ...q,
112 headers: { authorization: 'Bearer test-token', ...q.headers },
113 });
114 },
115 };
116}
117
118async function createSession(r: RunningServer): Promise<string> {
119 const res = await appOf(r).inject({

Callers 1

createSessionFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected