SetBody sets the body within the a notehubMessage data structure
(body map[string]interface{})
| 597 | |
| 598 | // SetBody sets the body within the a notehubMessage data structure |
| 599 | func (msg *notehubMessage) SetBody(body map[string]interface{}) error { |
| 600 | // Set native form |
| 601 | if msg.nf == nil { |
| 602 | msg.nf = &nf{} |
| 603 | } |
| 604 | msg.nf.Body = &body |
| 605 | |
| 606 | // Set compressed form |
| 607 | JSON, err := note.JSONMarshal(body) |
| 608 | if err != nil { |
| 609 | return err |
| 610 | } |
| 611 | if msg.cf == nil { |
| 612 | msg.cf = &cf{} |
| 613 | } |
| 614 | msg.cf.Body, err = jsonCompress(JSON) |
| 615 | |
| 616 | return err |
| 617 | } |
| 618 | |
| 619 | // GetBody gets the body from within the a notehubMessage |
| 620 | func (msg *notehubMessage) GetBody() (body map[string]interface{}, err error) { |
no test coverage detected