From 3e8f37472301a3950ba30ac897afeed01bcd1fe5 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 4 Jul 2023 14:47:28 +0200 Subject: [PATCH] test multipart --- src/fragments/mime.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/fragments/mime.rs b/src/fragments/mime.rs index 094a0c3..720fb8a 100644 --- a/src/fragments/mime.rs +++ b/src/fragments/mime.rs @@ -328,6 +328,8 @@ pub fn content_type(input: &str) -> IResult<&str, Type> { .into_iter() .partition(|p| matches!(p, Parameter::Boundary(_))); + println!("{:?} //// {:?}", boundary_param, unknown_parameters); + // @FIXME: if multiple boundary value is set, only the // first one is picked. We should check that it makes // sense with other implementation. @@ -460,6 +462,18 @@ mod tests { ); } + #[test] + fn test_content_type_multipart() { + assert_eq!( + Type::try_from(&lazy::Type("multipart/mixed;\r\n\tboundary=\"--==_mimepart_64a3f2c69114f_2a13d020975fe\";\r\n\tcharset=UTF-8")), + Ok(Type::Multipart(MultipartDesc { + subtype: MultipartSubtype::Mixed, + boundary: "--==_mimepart_64a3f2c69114f_2a13d020975fe".into(), + unknown_parameters: vec![Parameter::Charset(EmailCharset::UTF_8)], + })) + ); + } + /* #[test] fn test_parameter() { assert_eq!(