(next http.Handler)
| 34 | } |
| 35 | |
| 36 | func (s *Service) checkBackendMiddleware(next http.Handler) http.Handler { |
| 37 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 38 | back := s.Backend() |
| 39 | if back == nil { |
| 40 | http.Error(w, "backend not initialized", http.StatusInternalServerError) |
| 41 | return |
| 42 | } |
| 43 | if !back.Started() { |
| 44 | http.Error(w, "core is not started yet", http.StatusServiceUnavailable) |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | next.ServeHTTP(w, r) |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | func LogRequest(next http.Handler) http.Handler { |
| 53 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected