MCPcopy Index your code
hub / github.com/PasarGuard/node / checkBackendMiddleware

Method checkBackendMiddleware

controller/rest/middleware.go:36–50  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

34}
35
36func (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
52func LogRequest(next http.Handler) http.Handler {
53 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Implementers 1

Controllercontroller/controller.go

Calls 3

BackendMethod · 0.80
ErrorMethod · 0.80
StartedMethod · 0.65

Tested by

no test coverage detected