From a33456d12a145e6d9715bb129e8c135a6c1157c8 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Sun, 1 Dec 2024 02:31:56 +0300 Subject: [PATCH] multipart fix --- src/ezhttp/body.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ezhttp/body.rs b/src/ezhttp/body.rs index 10c7382..2b5788a 100644 --- a/src/ezhttp/body.rs +++ b/src/ezhttp/body.rs @@ -110,11 +110,14 @@ impl Body { Some((name.to_lowercase(), value.to_string())) }).collect::>(); let content_type = head.iter() - .find(|o| o.0.to_lowercase() == "content-type") + .find(|o| o.0 == "content-type") .map(|o| o.1.clone()); let (name, filename) = head.iter() - .find(|o| o.0.to_lowercase() == "content-disposition") - .map(|o| o.1.split(";").filter(|o| o == &"form-data").map(|s| s.trim().to_string()).collect::>()) + .find(|o| o.0 == "content-disposition") + .map(|o| o.1.split(";") + .filter(|o| o != &"form-data") + .map(|s| s.trim().to_string()) + .collect::>()) .map(|o| ( o.iter().find(|k| k.starts_with("name=\"")).map(|k| k[6..k.len()-1].to_string()), o.iter().find(|k| k.starts_with("filename=\"")).map(|k| k[10..k.len()-1].to_string())