body.rs
Rust test marker or harness
SHA-256a5b3df9b99ae82cd2d5d4010f08d63774bbee6ba438f51b4f428f376af271d66
MaleculeMd(Pa)
Evidence
1use bytes::{Bytes, BytesMut};
2use futures::Stream;
3use std::sync::Arc;
4use std::{fmt, mem};
5
6use context::ActorHttpContext;
7use error::Error;
8use handler::Responder;
9use httprequest::HttpRequest;
10use httpresponse::HttpResponse;
11
12/// Type represent streaming body
13pub type BodyStream = Box<Stream<Item = Bytes, Error = E …
21:18… ed streaming response. Developer is responsible for setting
22 /// right `Content-Length` or `Transfer-Encoding` headers.
23 Streaming(BodyStre …
29/// `Content-Length` header is set to length of the body.
30#[derive(Debug, PartialEq)]
31pub enum Binary {
32 /// Bytes body
33 Bytes(Bytes),
34 …
40:14… (Arc<Vec<u8>>),
41}
42
43impl Body {
44 /// Does this body streaming.
45 #[inline]
46 pub fn is_streaming(&self) -> bool {
47 match *self { …
263:30… plication/octet-stream")
264 .body(self))
265 }
266}
267
268#[cfg(test)]
269mod tests {
270 use super::*;
271
272 #[test]
273 fn test_body_is_streaming() {
274 assert_eq!(Body::Empty.is_streaming(), false);
275 assert_eq!(Body::Binary(Binary::from("")).is_strea …