GetBody gets the body from within the a notehubMessage
()
| 618 | |
| 619 | // GetBody gets the body from within the a notehubMessage |
| 620 | func (msg *notehubMessage) GetBody() (body map[string]interface{}, err error) { |
| 621 | body = map[string]interface{}{} |
| 622 | |
| 623 | // If native is available, return it |
| 624 | if msg.nf != nil && msg.nf.Body != nil { |
| 625 | body = *msg.nf.Body |
| 626 | return |
| 627 | } |
| 628 | |
| 629 | // If compressed is available, return it |
| 630 | if msg.cf != nil && len(msg.cf.Body) != 0 { |
| 631 | jdata, err2 := jsonDecompress(msg.cf.Body) |
| 632 | if err2 != nil { |
| 633 | err = err2 |
| 634 | } else { |
| 635 | err = note.JSONUnmarshal(jdata, &body) |
| 636 | } |
| 637 | return |
| 638 | } |
| 639 | |
| 640 | return |
| 641 | } |
| 642 | |
| 643 | // SetPayload sets the payload within the a notehubMessage data structure |
| 644 | func (msg *notehubMessage) SetPayload(payload []byte) { |
no test coverage detected