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

Function appOf

packages/server/test/config.e2e.test.ts:45–66  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

43}
44
45function appOf(r: RunningServer): {
46 inject: (req: unknown) => Promise<{ statusCode: number; json: () => unknown }>;
47} {
48 const app = r.services.invokeFunction((a) => {
49 const gw = a.get(IRestGateway);
50 return gw.app as unknown as {
51 inject: (req: unknown) => Promise<{ statusCode: number; json: () => unknown }>;
52};
53 });
54 // Auto-attach the fixed bearer token so the M5.1 auth hook passes. A
55 // caller-supplied `authorization` header wins, so explicit token tests keep
56 // working; every other header (Range, content-type, …) is preserved.
57 return {
58 inject(req: unknown) {
59 const q = req as { headers?: Record<string, string | string[] | undefined> };
60 return app.inject({
61 ...q,
62 headers: { authorization: 'Bearer test-token', ...q.headers },
63 });
64 },
65 };
66}
67
68function envelopeOf<T>(body: unknown): {
69 code: number;

Callers 1

config.e2e.test.tsFile · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected