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