(s *Service)
| 198 | } |
| 199 | |
| 200 | func ConditionalMiddleware(s *Service) grpc.UnaryServerInterceptor { |
| 201 | return func( |
| 202 | ctx context.Context, |
| 203 | req interface{}, |
| 204 | info *grpc.UnaryServerInfo, |
| 205 | handler grpc.UnaryHandler, |
| 206 | ) (interface{}, error) { |
| 207 | var interceptors []grpc.UnaryServerInterceptor |
| 208 | |
| 209 | interceptors = append(interceptors, LoggingInterceptor(s)) |
| 210 | |
| 211 | interceptors = append(interceptors, validateApiKeyMiddleware(s)) |
| 212 | |
| 213 | if backendMethods[info.FullMethod] { |
| 214 | interceptors = append(interceptors, CheckBackendMiddleware(s)) |
| 215 | } |
| 216 | |
| 217 | chained := grpcmiddleware.ChainUnaryServer(interceptors...) |
| 218 | return chained(ctx, req, info, handler) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | func ConditionalStreamMiddleware(s *Service) grpc.StreamServerInterceptor { |
| 223 | return func( |
no test coverage detected