send_bytes
This commit is contained in:
@@ -135,6 +135,25 @@ impl Request {
|
||||
self.do_call(Payload::JSON(data))
|
||||
}
|
||||
|
||||
/// Send data as bytes.
|
||||
///
|
||||
/// The `Content-Length` header is implicitly set to the length of the serialized value.
|
||||
///
|
||||
/// ```
|
||||
/// #[macro_use]
|
||||
/// extern crate ureq;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let body = b"Hello world!";
|
||||
/// let r = ureq::post("/my_page")
|
||||
/// .send_bytes(body);
|
||||
/// println!("{:?}", r);
|
||||
/// }
|
||||
/// ```
|
||||
pub fn send_bytes(&mut self, data: &[u8]) -> Response {
|
||||
self.do_call(Payload::Bytes(data.to_owned()))
|
||||
}
|
||||
|
||||
/// Send data as a string.
|
||||
///
|
||||
/// The `Content-Length` header is implicitly set to the length of the serialized value.
|
||||
|
||||
Reference in New Issue
Block a user