From c22a3a71f2b366bf7af6fd0e00e5f150835645c0 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 8 Apr 2019 19:07:11 -0700 Subject: [PATCH] fix test --- actix-http/src/h1/dispatcher.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index 9014047d7..8c0af007e 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -824,7 +824,7 @@ mod tests { use super::*; use crate::error::Error; - use crate::h1::ExpectHandler; + use crate::h1::{ExpectHandler, UpgradeHandler}; struct Buffer { buf: Bytes, @@ -884,25 +884,21 @@ mod tests { let _ = sys.block_on(lazy(|| { let buf = Buffer::new("GET /test HTTP/1\r\n\r\n"); - let mut h1 = Dispatcher::new( + let mut h1 = Dispatcher::<_, _, _, _, UpgradeHandler>::new( buf, ServiceConfig::default(), CloneableService::new( (|_| ok::<_, Error>(Response::Ok().finish())).into_service(), ), CloneableService::new(ExpectHandler), + None, ); assert!(h1.poll().is_err()); - assert!(h1 - .inner - .as_ref() - .unwrap() - .flags - .contains(Flags::READ_DISCONNECT)); - assert_eq!( - &h1.inner.as_ref().unwrap().io.write_buf[..26], - b"HTTP/1.1 400 Bad Request\r\n" - ); + + if let DispatcherState::Normal(ref inner) = h1.inner { + assert!(inner.flags.contains(Flags::READ_DISCONNECT)); + assert_eq!(&inner.io.write_buf[..26], b"HTTP/1.1 400 Bad Request\r\n"); + } ok::<_, ()>(()) })); }