Skip to content

Commit

Permalink
Standardize lag status response format
Browse files Browse the repository at this point in the history
  • Loading branch information
yzang2019 committed Jan 12, 2024
1 parent 778330b commit f9b3d1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/jsonrpc/server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ func writeHTTPResponse(w http.ResponseWriter, log log.Logger, rsp rpctypes.RPCRe
return
}
statusCode := http.StatusOK
// If there's any error for lag is high, override the status code
// If there's any error for lag is high, override the status code and response body
if rsp.Error != nil && rsp.Error.Code == int(rpctypes.CodeLagIsHighError) {
body = rsp.Result
statusCode = http.StatusExpectationFailed
}
w.Header().Set("Content-Type", "application/json")
Expand Down

0 comments on commit f9b3d1e

Please sign in to comment.