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

Function appOf

packages/server/test/question.e2e.test.ts:79–100  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected