Newer
Older
// Code generated by goa v3.12.3, DO NOT EDIT.
//
// health HTTP server encoders and decoders
//
// Command:
// $ goa gen gitlab.eclipse.org/eclipse/xfsc/tsa/policy/design
package server
import (
"context"
"net/http"
health "gitlab.eclipse.org/eclipse/xfsc/tsa/policy/gen/health"
goahttp "goa.design/goa/v3/http"
)
// EncodeLivenessResponse returns an encoder for responses returned by the
// health Liveness endpoint.
func EncodeLivenessResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*health.HealthResponse)
enc := encoder(ctx, w)
body := NewLivenessResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
}
// EncodeReadinessResponse returns an encoder for responses returned by the
// health Readiness endpoint.
func EncodeReadinessResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {
return func(ctx context.Context, w http.ResponseWriter, v any) error {
res, _ := v.(*health.HealthResponse)
enc := encoder(ctx, w)
body := NewReadinessResponseBody(res)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)