func (rw *JSONResultWriter) Write(result *CheckerResult, statusCode int, w http.ResponseWriter, r *http.Request) error {
	jsonResp, err := json.Marshal(result)
	if err != nil {
		return fmt.Errorf("cannot marshal response: %w", err)
	}
	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	w.WriteHeader(statusCode)
	_, err = w.Write(jsonResp)
	return err
}
Write implements ResultWriter.Write.
package health
import (
	"encoding/json"
	"fmt"
	"net/http"
)
type (
	handlerConfig struct {
		statusCodeUp   int
		statusCodeDown int
		middleware     []Middleware
		resultWriter   ResultWriter
	}
	Middleware func(next MiddlewareFunc) MiddlewareFunc
	MiddlewareFunc func(r *http.Request) CheckerResult
	ResultWriter interface {
		Write(result *CheckerResult, statusCode int, w http.ResponseWriter, r *http.Request) error
	}
	JSONResultWriter struct{}
)