From fc03222d83ce507fdb8a961ae69918510d871eaf Mon Sep 17 00:00:00 2001 From: 1998-felix Date: Wed, 17 Apr 2024 08:33:36 +0300 Subject: [PATCH] Dep: Update gocoap from v2 to v3 Signed-off-by: 1998-felix --- coap/api/transport.go | 2 +- coap/client.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/coap/api/transport.go b/coap/api/transport.go index 417c24255fc..fcbcb315be6 100644 --- a/coap/api/transport.go +++ b/coap/api/transport.go @@ -107,7 +107,7 @@ func handler(w mux.ResponseWriter, m *mux.Message) { isObs, err = handleGet(context.Background(), m, w, msg, key) case codes.POST: resp.Code = codes.Created - err = nil + err = service.Publish(m.Context(), key, msg) default: err = svcerr.ErrNotFound } diff --git a/coap/client.go b/coap/client.go index ea8a52e17a4..08a26f36f8f 100644 --- a/coap/client.go +++ b/coap/client.go @@ -102,5 +102,8 @@ func (c *client) Handle(msg *messaging.Message) error { for _, option := range opts { pm.SetOptionBytes(option.ID, option.Value) } - return c.client.Conn().WriteMessage(pm) + if err = c.client.Conn().WriteMessage(pm); err != nil { + return err + } + return nil }