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

Function appOf

packages/server/test/fs-search.e2e.test.ts:64–91  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected