-
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Any header_*() or with_*() option discards default settings, and existing with_*()-shortcuts don't cover all of the defaults.
Exhibit A
diff --git a/examples/message_parse.rs b/examples/message_parse.rs
index 1b450f6..79b22eb 100644
--- a/examples/message_parse.rs
+++ b/examples/message_parse.rs
@@ -48,7 +48,9 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
--festivus--
"#;
- let message = MessageParser::default().parse(input).unwrap();
+ let message = MessageParser::default()
+ .header_text("Organization")
+ .parse(input).unwrap();
// Parses addresses (including comments), lists and groups
assert_eq!(thread 'main' panicked at examples/message_parse.rs:57:24:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Exhibit B
diff --git a/examples/message_parse.rs b/examples/message_parse.rs
index 1b450f6..d150698 100644
--- a/examples/message_parse.rs
+++ b/examples/message_parse.rs
@@ -13,6 +13,7 @@ To: "Colleagues": "James Smythe" <[email protected]>; Friends:
Date: Sat, 20 Nov 2021 14:22:01 -0800
Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?=
Content-Type: multipart/mixed; boundary="festivus";
+List-Unsubscribe: <[email protected]>
--festivus
Content-Type: text/html; charset="us-ascii"
@@ -48,7 +49,23 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
--festivus--
"#;
- let message = MessageParser::default().parse(input).unwrap();
+ let message = MessageParser::default()
+ .header_text("Organization")
+ // use all of the shortcuts available
+ .with_mime_headers()
+ .with_address_headers()
+ .with_date_headers()
+ .with_message_ids()
+ .with_minimal_headers()
+ .parse(input).unwrap();
+
+ assert_eq!(
+ message.header("list-unsubscribe").unwrap().clone().unwrap_address().first().unwrap(),
+ &Addr::new(
+ None,
+ "[email protected]"
+ )
+ );
// Parses addresses (including comments), lists and groups
assert_eq!(thread 'main' panicked at src/core/header.rs:86:18:
HeaderValue::unwrap_address called on non-Address value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
New test works with just default()
Metadata
Metadata
Assignees
Labels
No labels