Skip to content

Commit

Permalink
Fix fanout request body for Msgpack payloads (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
renaz6 committed May 2, 2023
1 parent 28599f9 commit f8c9f7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion WRPHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
gokithttp "github.com/go-kit/kit/transport/http"
"github.com/xmidt-org/webpa-common/v2/xhttp"
"github.com/xmidt-org/wrp-go/v3"
"github.com/xmidt-org/wrp-go/v3/wrpcontext"
"github.com/xmidt-org/wrp-go/v3/wrphttp"
)

Expand Down Expand Up @@ -58,14 +59,15 @@ func newWRPFanoutHandlerWithPIDCheck(fanoutHandler http.Handler, p wrpAccessAuth
fanoutBody = r.Entity.Bytes
)

_, decoded := wrpcontext.Get[wrp.Message](ctx)
modified, err := p.authorizeWRP(ctx, &entity.Message)

if err != nil {
encodeError(ctx, err, w)
return
}

if modified {
if modified || decoded {
if err := wrp.NewEncoderBytes(&fanoutBody, entity.Format).Encode(entity.Message); err != nil {
encodeError(ctx, err, w)
return
Expand Down

0 comments on commit f8c9f7c

Please sign in to comment.