Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions core/src/raw/http_util/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ use crate::Error;
use crate::ErrorKind;
use crate::Result;

use super::multipart::Multipart;

/// Body used in async HTTP requests.
#[derive(Default)]
pub enum AsyncBody {
Expand All @@ -43,11 +41,6 @@ pub enum AsyncBody {
Empty,
/// Body with bytes.
Bytes(Bytes),
/// Body with a multipart field.
///
/// If input with this field, we will goto the internal multipart
/// handle logic.
Multipart(Multipart),
}

type BytesStream = Box<dyn Stream<Item = Result<Bytes>> + Send + Sync + Unpin>;
Expand Down
15 changes: 0 additions & 15 deletions core/src/raw/http_util/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ use std::mem;
use std::str::FromStr;

use futures::TryStreamExt;
use http::header::CONTENT_LENGTH;
use http::header::CONTENT_TYPE;
use http::Request;
use http::Response;
use reqwest::redirect::Policy;
Expand Down Expand Up @@ -99,19 +97,6 @@ impl HttpClient {
req_builder = match body {
AsyncBody::Empty => req_builder.body(reqwest::Body::from("")),
AsyncBody::Bytes(bs) => req_builder.body(reqwest::Body::from(bs)),
AsyncBody::Multipart(mp) => {
let (boundary, bs) = mp.build();

// Insert content type with correct boundary.
req_builder = req_builder.header(
CONTENT_TYPE,
format!("multipart/form-data; boundary={boundary}").as_str(),
);
// Insert content length with calculated size.
req_builder = req_builder.header(CONTENT_LENGTH, bs.len());

req_builder.body(reqwest::Body::from(bs))
}
};

let mut resp = req_builder.send().await.map_err(|err| {
Expand Down
2 changes: 2 additions & 0 deletions core/src/raw/http_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@ mod bytes_content_range;
pub use bytes_content_range::BytesContentRange;

mod multipart;
pub use multipart::FormDataPart;
pub use multipart::MixedPart;
pub use multipart::Multipart;
pub use multipart::Part;
Loading