Skip to content

Commit

Permalink
Merge pull request #114 from kcajmagic/feature/fullwrp
Browse files Browse the repository at this point in the history
adding webhook sending of full wrp message
  • Loading branch information
schmidtw authored Feb 14, 2019
2 parents e992219 + 7ca7d0e commit f10f3c1
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 f10f3c1

Please sign in to comment.