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

better method name

This commit is contained in:
Nikolay Kim
2017-11-19 18:55:37 -10:00
parent 766e243c63
commit 5945035fc3
3 changed files with 13 additions and 5 deletions

View File

@@ -42,8 +42,8 @@ pub enum Binary {
}
impl Body {
/// Does this body have payload.
pub fn has_body(&self) -> bool {
/// Does this body streaming.
pub fn is_streaming(&self) -> bool {
match *self {
Body::Length(_) | Body::Streaming => true,
_ => false
@@ -205,6 +205,14 @@ impl From<Binary> for Frame {
mod tests {
use super::*;
#[test]
fn test_body_is_streaming() {
assert_eq!(Body::Empty.is_streaming(), false);
assert_eq!(Body::Binary(Binary::from("")).is_streaming(), false);
assert_eq!(Body::Length(100).is_streaming(), true);
assert_eq!(Body::Streaming.is_streaming(), true);
}
#[test]
fn test_is_empty() {
assert_eq!(Binary::from("").is_empty(), true);