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

Function appOf

packages/server/test/auth.e2e.test.ts:71–92  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70
auth.e2e.test.tsFile · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected