From 55dd894e07aacd5983a055ec2a25676804c278ca Mon Sep 17 00:00:00 2001 From: artpav <19916123+artemijspavlovs@users.noreply.github.com> Date: Sat, 18 May 2024 10:50:04 +0300 Subject: [PATCH] fix(rpc): remove unnecessary `:` in the json health response (#876) --- rpc/middleware/middleware_test.go | 4 ++-- rpc/middleware/status.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpc/middleware/middleware_test.go b/rpc/middleware/middleware_test.go index a02b42c5b..daadcffa7 100644 --- a/rpc/middleware/middleware_test.go +++ b/rpc/middleware/middleware_test.go @@ -76,12 +76,12 @@ func TestStatusMiddleware(t *testing.T) { { healthy: nil, expectedStatus: http.StatusOK, - expectedMessage: "{\"jsonrpc\":\"2.0\",\"result\":{\"isHealthy\":true,:\"error\":\"\"},\"id\":-1}", + expectedMessage: "{\"jsonrpc\":\"2.0\",\"result\":{\"isHealthy\":true,\"error\":\"\"},\"id\":-1}", }, { healthy: errors.New("node unhealthy"), expectedStatus: http.StatusOK, - expectedMessage: "{\"jsonrpc\":\"2.0\",\"result\":{\"isHealthy\":false,:\"error\":\"node unhealthy\"},\"id\":-1}", + expectedMessage: "{\"jsonrpc\":\"2.0\",\"result\":{\"isHealthy\":false,\"error\":\"node unhealthy\"},\"id\":-1}", }, } diff --git a/rpc/middleware/status.go b/rpc/middleware/status.go index 3b16af062..01e16e559 100644 --- a/rpc/middleware/status.go +++ b/rpc/middleware/status.go @@ -24,7 +24,7 @@ func (s Status) Handler(logger log.Logger) HandlerFunc { if err != nil { errS = err.Error() } - json := `{"jsonrpc":"2.0","result":{"isHealthy":` + strconv.FormatBool(isHealthy) + `,:"error":"` + errS + `"},"id":-1}` + json := `{"jsonrpc":"2.0","result":{"isHealthy":` + strconv.FormatBool(isHealthy) + `,"error":"` + errS + `"},"id":-1}` _, err = w.Write([]byte(json)) if err != nil { return