Make multipart an optional feature (default off) (#1128)
This commit is contained in:
@@ -152,6 +152,7 @@ impl Body {
|
||||
ImplStream(self)
|
||||
}
|
||||
|
||||
#[cfg(feature = "multipart")]
|
||||
pub(crate) fn content_length(&self) -> Option<u64> {
|
||||
match self.inner {
|
||||
Inner::Reusable(ref bytes) => Some(bytes.len() as u64),
|
||||
|
||||
@@ -9,6 +9,7 @@ pub(crate) use self::decoder::Decoder;
|
||||
pub mod body;
|
||||
pub mod client;
|
||||
pub mod decoder;
|
||||
#[cfg(feature = "multipart")]
|
||||
pub mod multipart;
|
||||
pub(crate) mod request;
|
||||
mod response;
|
||||
|
||||
@@ -11,9 +11,12 @@ use serde_json;
|
||||
|
||||
use super::body::Body;
|
||||
use super::client::{Client, Pending};
|
||||
#[cfg(feature = "multipart")]
|
||||
use super::multipart;
|
||||
use super::response::Response;
|
||||
use crate::header::{HeaderMap, HeaderName, HeaderValue, CONTENT_LENGTH, CONTENT_TYPE};
|
||||
use crate::header::{HeaderMap, HeaderName, HeaderValue, CONTENT_TYPE};
|
||||
#[cfg(feature = "multipart")]
|
||||
use crate::header::CONTENT_LENGTH;
|
||||
use crate::{Method, Url};
|
||||
use http::{Request as HttpRequest, request::Parts};
|
||||
|
||||
@@ -260,6 +263,7 @@ impl RequestBuilder {
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(feature = "multipart")]
|
||||
pub fn multipart(self, mut multipart: multipart::Form) -> RequestBuilder {
|
||||
let mut builder = self.header(
|
||||
CONTENT_TYPE,
|
||||
|
||||
Reference in New Issue
Block a user