Skip to content

Commit

Permalink
fix(rpc): remove unnecessary : in the json health response (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs authored May 18, 2024
1 parent 04b13a0 commit 55dd894
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rpc/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
},
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/middleware/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55dd894

Please sign in to comment.