( group: Group, endpoint: HttpApiEndpoint.Top, context: Context.Context<any>, handler: A )
| 848 | } |
| 849 | |
| 850 | const applyMiddleware = <Group extends HttpApiGroup.Constraint, A extends Effect.Effect<any, any, any>>( |
| 851 | group: Group, |
| 852 | endpoint: HttpApiEndpoint.Top, |
| 853 | context: Context.Context<any>, |
| 854 | handler: A |
| 855 | ) => { |
| 856 | const options = { group, endpoint } |
| 857 | for (const key_ of endpoint.middlewares) { |
| 858 | const key = key_ as HttpApiMiddleware.AnyService |
| 859 | const service = Context.getUnsafe(context, key) |
| 860 | const apply = HttpApiMiddleware.isSecurity(key) |
| 861 | ? makeSecurityMiddleware(key, service) |
| 862 | : service |
| 863 | handler = apply(handler, options) |
| 864 | } |
| 865 | return handler |
| 866 | } |
| 867 | |
| 868 | const securityMiddlewareCache = new WeakMap< |
| 869 | object, |
no test coverage detected