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

Function appOf

packages/server/test/fs-mkdir.e2e.test.ts:61–88  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 2

createSessionFunction · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected