Skip to content

Commit

Permalink
remove uuid check
Browse files Browse the repository at this point in the history
Signed-off-by: SammyOina <sammyoina@gmail.com>
  • Loading branch information
SammyOina authored and dborovcanin committed May 29, 2023
1 parent 9300ea0 commit a272540
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions http/api/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
kitot "github.com/go-kit/kit/tracing/opentracing"
kithttp "github.com/go-kit/kit/transport/http"
"github.com/go-zoo/bone"
"github.com/hashicorp/go-uuid"
"github.com/mainflux/mainflux"
adapter "github.com/mainflux/mainflux/http"
"github.com/mainflux/mainflux/internal/apiutil"
Expand Down Expand Up @@ -122,27 +121,17 @@ func decodeRequest(ctx context.Context, r *http.Request) (interface{}, error) {
case !ok:
token = apiutil.ExtractThingKey(r)
}
_, err = uuid.ParseUUID(token)
if err != nil {
return nil, errors.ErrMalformedEntity
}

payload, err := ioutil.ReadAll(r.Body)
if err != nil {
return nil, errors.ErrMalformedEntity
}
defer r.Body.Close()

channel := bone.GetValue(r, "chanID")
_, err = uuid.ParseUUID(channel)
if err != nil {
return nil, errors.ErrMalformedEntity
}

req := publishReq{
msg: &messaging.Message{
Protocol: protocol,
Channel: channel,
Channel: bone.GetValue(r, "chanID"),
Subtopic: subtopic,
Payload: payload,
Created: time.Now().UnixNano(),
Expand Down

0 comments on commit a272540

Please sign in to comment.