Implement Body::sized
This is necessary for APIs such as BigML's, where we may need to send extremely large request bodies, but chunked transfer encoding is not supported. This is a partial fix for seanmonstar/reqwest#49.
This commit is contained in:
12
src/body.rs
12
src/body.rs
@@ -27,11 +27,17 @@ impl Body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Create a `Body` from a `Reader` where we can predict the size in
|
||||||
pub fn sized(reader: (), len: u64) -> Body {
|
/// advance, but where we don't want to load the data in memory. This
|
||||||
unimplemented!()
|
/// is useful if we need to ensure `Content-Length` is passed with the
|
||||||
|
/// request.
|
||||||
|
pub fn sized<R: Read + Send + 'static>(reader: R, len: u64) -> Body {
|
||||||
|
Body {
|
||||||
|
reader: Kind::Reader(Box::new(reader), Some(len)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
pub fn chunked(reader: ()) -> Body {
|
pub fn chunked(reader: ()) -> Body {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user