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

Function appOf

packages/server/test/approval.e2e.test.ts:78–99  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected