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

Function appOf

packages/server/test/workspaces.e2e.test.ts:65–86  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected