mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-26 14:51:49 +00:00
fc6194bb6b
* Rest endoint /health added * Remove dev-debug echo * Changed not ready message * Update waku/node/rest/health/handlers.nim Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com> * Various fixes on PR foundings, added comments --------- Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
31 lines
830 B
Nim
31 lines
830 B
Nim
when (NimMajor, NimMinor) < (1, 4):
|
|
{.push raises: [Defect].}
|
|
else:
|
|
{.push raises: [].}
|
|
|
|
import
|
|
chronicles,
|
|
json_serialization,
|
|
json_serialization/std/options,
|
|
presto/[route, client]
|
|
import
|
|
../serdes,
|
|
../responses
|
|
|
|
logScope:
|
|
topics = "waku node rest health_api"
|
|
|
|
proc decodeBytes*(t: typedesc[string], value: openArray[byte],
|
|
contentType: Opt[ContentTypeData]): RestResult[string] =
|
|
if MediaType.init($contentType) != MIMETYPE_TEXT:
|
|
error "Unsupported contentType value", contentType = contentType
|
|
return err("Unsupported contentType")
|
|
|
|
var res: string
|
|
if len(value) > 0:
|
|
res = newString(len(value))
|
|
copyMem(addr res[0], unsafeAddr value[0], len(value))
|
|
return ok(res)
|
|
|
|
proc healthCheck*(): RestResponse[string] {.rest, endpoint: "/health", meth: HttpMethod.MethodGet.}
|