( group: Group, endpoint: HttpApiEndpoint.Top, context: Context.Context<any>, handler: A )
| 1094 | } |
| 1095 | |
| 1096 | const applyMiddleware = <Group extends HttpApiGroup.Constraint, A extends Effect.Effect<any, any, any>>( |
| 1097 | group: Group, |
| 1098 | endpoint: HttpApiEndpoint.Top, |
| 1099 | context: Context.Context<any>, |
| 1100 | handler: A |
| 1101 | ) => { |
| 1102 | const options = { group, endpoint } |
| 1103 | for (const key_ of endpoint.middlewares) { |
| 1104 | const key = key_ as HttpApiMiddleware.AnyService |
| 1105 | const service = Context.getUnsafe(context, key) |
| 1106 | const apply = HttpApiMiddleware.isSecurity(key) |
| 1107 | ? makeSecurityMiddleware(key, service) |
| 1108 | : service |
| 1109 | handler = apply(handler, options) |
| 1110 | } |
| 1111 | return handler |
| 1112 | } |
| 1113 | |
| 1114 | const securityMiddlewareCache = new WeakMap< |
| 1115 | object, |
no test coverage detected