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

Function appOf

packages/server/test/oauth.e2e.test.ts:137–158  ·  view source on GitHub ↗
(r: RunningServer)

Source from the content-addressed store, hash-verified

135}
136
137function appOf(r: RunningServer): {
138 inject: (req: unknown) => Promise<{ statusCode: number; json: () => unknown }>;
139} {
140 const app = r.services.invokeFunction((a) => {
141 const gw = a.get(IRestGateway);
142 return gw.app as unknown as {
143 inject: (req: unknown) => Promise<{ statusCode: number; json: () => unknown }>;
144};
145 });
146 // Auto-attach the fixed bearer token so the M5.1 auth hook passes. A
147 // caller-supplied `authorization` header wins, so explicit token tests keep
148 // working; every other header (Range, content-type, …) is preserved.
149 return {
150 inject(req: unknown) {
151 const q = req as { headers?: Record<string, string | string[] | undefined> };
152 return app.inject({
153 ...q,
154 headers: { authorization: 'Bearer test-token', ...q.headers },
155 });
156 },
157 };
158}
159
160function envelopeOf<T>(body: unknown): {
161 code: number;

Callers 1

oauth.e2e.test.tsFile · 0.70

Calls 2

invokeFunctionMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected