This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new ee9e218c2 feat(core/raw): support stream body for mixedpart (#2936)
ee9e218c2 is described below

commit ee9e218c295942f33ed90dd2082b692e8a99e555
Author: Mingzhuo Yin <[email protected]>
AuthorDate: Fri Aug 25 17:47:45 2023 +0800

    feat(core/raw): support stream body for mixedpart (#2936)
    
    Signed-off-by: silver-ymz <[email protected]>
---
 core/src/raw/http_util/multipart.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/src/raw/http_util/multipart.rs 
b/core/src/raw/http_util/multipart.rs
index d890ceed2..edc061c1f 100644
--- a/core/src/raw/http_util/multipart.rs
+++ b/core/src/raw/http_util/multipart.rs
@@ -410,7 +410,15 @@ impl MixedPart {
                 bs.len() as u64,
                 Some(Box::new(oio::Cursor::from(bs)) as Streamer),
             ),
-            AsyncBody::Stream(_) => panic!("multipart request can't contain 
stream body"),
+            AsyncBody::Stream(stream) => {
+                let len = parts
+                    .headers
+                    .get(CONTENT_LENGTH)
+                    .and_then(|v| v.to_str().ok())
+                    .and_then(|v| v.parse::<u64>().ok())
+                    .expect("the content length of a mixed part must be 
valid");
+                (len, Some(stream))
+            }
         };
 
         Self {

Reply via email to