github.com/ethersphere/bee/v2@v2.2.0/pkg/api/readiness.go (about)

     1  // Copyright 2021 The Swarm Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package api
     6  
     7  import "net/http"
     8  
     9  func (s *Service) readinessHandler(w http.ResponseWriter, _ *http.Request) {
    10  	if s.probe.Ready() == ProbeStatusOK {
    11  		w.WriteHeader(http.StatusOK)
    12  	} else {
    13  		w.WriteHeader(http.StatusBadRequest)
    14  	}
    15  }