diff --git a/services/api/service.go b/services/api/service.go index c6d4291f..197f6ce2 100644 --- a/services/api/service.go +++ b/services/api/service.go @@ -825,7 +825,7 @@ func (api *RelayAPI) RespondOK(w http.ResponseWriter, response any) { } func (api *RelayAPI) RespondMsg(w http.ResponseWriter, code int, msg string) { - api.Respond(w, code, struct{ message string }{message: msg}) + api.Respond(w, code, MessageResp{msg}) } func (api *RelayAPI) Respond(w http.ResponseWriter, code int, response any) { diff --git a/services/api/service_test.go b/services/api/service_test.go index b9c6e361..2d4e651f 100644 --- a/services/api/service_test.go +++ b/services/api/service_test.go @@ -199,6 +199,14 @@ func TestStatus(t *testing.T) { require.Equal(t, http.StatusOK, rr.Code) } +func TestLivez(t *testing.T) { + backend := newTestBackend(t, 1) + path := "/livez" + rr := backend.request(http.MethodGet, path, nil) + require.Equal(t, http.StatusOK, rr.Code) + require.Equal(t, "{\"message\":\"ok\"}\n", rr.Body.String()) +} + func TestRegisterValidator(t *testing.T) { path := "/eth/v1/builder/validators" diff --git a/services/api/types.go b/services/api/types.go index bb732ebf..d6dfb3d6 100644 --- a/services/api/types.go +++ b/services/api/types.go @@ -11,6 +11,9 @@ var ( ErrMissingSecretKey = errors.New("secret key is nil") ErrEmptyPayload = errors.New("nil payload") ErrInvalidTransaction = errors.New("invalid transaction") + + NilResponse = struct{}{} + ZeroU256 = boostTypes.IntToU256(0) ) type HTTPErrorResp struct { @@ -18,6 +21,6 @@ type HTTPErrorResp struct { Message string `json:"message"` } -var NilResponse = struct{}{} - -var ZeroU256 = boostTypes.IntToU256(0) +type MessageResp struct { + Message string `json:"message"` +}