mirror of https://github.com/waku-org/nwaku.git
fix: lightpush rest (#2176)
* rest/lightpush/handlers.nim: enhance feedback in case of error. * lightpush/openapi.yaml: fix typo in pubsubTopic field.
This commit is contained in:
parent
52759faa03
commit
fa467e2462
|
@ -75,14 +75,14 @@ proc installLightPushRequestHandler*(
|
||||||
let req: PushRequest = decodedBody.value()
|
let req: PushRequest = decodedBody.value()
|
||||||
|
|
||||||
let msg = req.message.toWakuMessage().valueOr:
|
let msg = req.message.toWakuMessage().valueOr:
|
||||||
return RestApiResponse.badRequest("Invalid message: {msg.error}")
|
return RestApiResponse.badRequest("Invalid message: " & $error)
|
||||||
|
|
||||||
let peer = node.peerManager.selectPeer(WakuLightPushCodec).valueOr:
|
let peer = node.peerManager.selectPeer(WakuLightPushCodec).valueOr:
|
||||||
let handler = discHandler.valueOr:
|
let handler = discHandler.valueOr:
|
||||||
return NoPeerNoDiscoError
|
return NoPeerNoDiscoError
|
||||||
|
|
||||||
let peerOp = (await handler()).valueOr:
|
let peerOp = (await handler()).valueOr:
|
||||||
return RestApiResponse.internalServerError($error)
|
return RestApiResponse.internalServerError("No value in peerOp: " & $error)
|
||||||
|
|
||||||
peerOp.valueOr:
|
peerOp.valueOr:
|
||||||
return NoPeerNoneFoundError
|
return NoPeerNoneFoundError
|
||||||
|
|
|
@ -76,7 +76,7 @@ components:
|
||||||
PushRequest:
|
PushRequest:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
pusbsubTopic:
|
pubsubTopic:
|
||||||
$ref: '#/components/schemas/PubsubTopic'
|
$ref: '#/components/schemas/PubsubTopic'
|
||||||
message:
|
message:
|
||||||
$ref: '#/components/schemas/WakuMessage'
|
$ref: '#/components/schemas/WakuMessage'
|
||||||
|
|
Loading…
Reference in New Issue