1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 01:31:57 +02:00

add response content encoding

This commit is contained in:
Nikolay Kim
2017-11-08 16:44:23 -08:00
parent 76b8104f52
commit e558414867
9 changed files with 635 additions and 361 deletions

View File

@@ -50,6 +50,14 @@ impl Body {
}
}
/// Is this binary body.
pub fn is_binary(&self) -> bool {
match *self {
Body::Binary(_) => true,
_ => false
}
}
/// Create body from slice (copy)
pub fn from_slice(s: &[u8]) -> Body {
Body::Binary(BinaryBody::Bytes(Bytes::from(s)))