Skip to content

Commit

Permalink
adding webhook sending of full wrp message
Browse files Browse the repository at this point in the history
  • Loading branch information
kcajmagic committed Dec 4, 2018
1 parent ce1a924 commit 7ca7d0e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/caduceus/outboundSender.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,22 @@ func (obs *CaduceusOutboundSender) worker(id int) {
if now.After(dropUntil) {
if now.Before(deliverUntil) {
payload := msg.Payload
payloadReader := bytes.NewReader(payload)
var payloadReader *bytes.Reader
if obs.listener.Config.ContentType == "wrp" {
buffer := bytes.NewBuffer([]byte{})
var f wrp.Format
switch msg.ContentType {
case "json":
f = wrp.JSON
default:
f = wrp.Msgpack
}
encoder := wrp.NewEncoder(buffer, f)
encoder.Encode(msg)
payloadReader = bytes.NewReader(buffer.Bytes())
} else {
payloadReader = bytes.NewReader(payload)
}
req, err := http.NewRequest("POST", obs.id, payloadReader)
if nil != err {
// Report drop
Expand Down

0 comments on commit 7ca7d0e

Please sign in to comment.