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

Function appOf

packages/server/test/prompt.e2e.test.ts:77–98  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70
prompt.e2e.test.tsFile · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected