Use HTTP status codes instead of status in body.

This commit is contained in:
cheatfate 2022-01-28 13:46:48 +02:00 committed by zah
parent e264276b36
commit 1287a20b13

View File

@ -260,12 +260,12 @@ proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) =
router.api(MethodGet, "/eth/v1/node/health") do () -> RestApiResponse: router.api(MethodGet, "/eth/v1/node/health") do () -> RestApiResponse:
# TODO: Add ability to detect node's issues and return 503 error according # TODO: Add ability to detect node's issues and return 503 error according
# to specification. # to specification.
let res = let status =
if node.syncManager.inProgress: if node.syncManager.inProgress:
(health: 206) Http206
else: else:
(health: 200) Http200
return RestApiResponse.jsonResponse(res) return RestApiResponse.response("", status, contentType = "")
# Legacy URLS - Nimbus <= 1.5.5 used to expose the REST API with an additional # Legacy URLS - Nimbus <= 1.5.5 used to expose the REST API with an additional
# `/api` path component # `/api` path component