diff --git a/src/message.rs b/src/message.rs index 2c8959b..3248451 100644 --- a/src/message.rs +++ b/src/message.rs @@ -166,7 +166,7 @@ impl<'a> TryFrom<&'a Element> for Message { to: to, id: id, type_: type_, - bodies: BTreeMap::new(), + bodies: bodies, subjects: subjects, payloads: payloads, }) @@ -263,7 +263,11 @@ mod tests { #[test] fn test_body() { let elem: Element = "Hello world!".parse().unwrap(); - Message::try_from(&elem).unwrap(); + let message = Message::try_from(&elem).unwrap(); + assert_eq!(message.bodies[""], "Hello world!"); + + let elem2 = (&message).into(); + assert_eq!(elem, elem2); } #[test]