Replace public use of mime crate with &str (#642)

Replaces `Field::content_type`'s return type with `&str`.
This is a breaking change.

Closes #637
This commit is contained in:
Nick Ashley
2022-01-23 18:01:52 +01:00
committed by David Pedersen
parent 4df4e07e10
commit 9b4232b786
4 changed files with 58 additions and 8 deletions
+9 -1
View File
@@ -65,8 +65,16 @@ async fn accept_form(
) {
while let Some(field) = multipart.next_field().await.unwrap() {
let name = field.name().unwrap().to_string();
let file_name = field.file_name().unwrap().to_string();
let content_type = field.content_type().unwrap().to_string();
let data = field.bytes().await.unwrap();
println!("Length of `{}` is {} bytes", name, data.len());
println!(
"Length of `{}` (`{}`: `{}`) is {} bytes",
name,
file_name,
content_type,
data.len()
);
}
}