1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01:00
This commit is contained in:
Nikolay Kim 2019-04-08 19:07:11 -07:00
parent 9c9940d88d
commit c22a3a71f2

View File

@ -824,7 +824,7 @@ mod tests {
use super::*; use super::*;
use crate::error::Error; use crate::error::Error;
use crate::h1::ExpectHandler; use crate::h1::{ExpectHandler, UpgradeHandler};
struct Buffer { struct Buffer {
buf: Bytes, buf: Bytes,
@ -884,25 +884,21 @@ mod tests {
let _ = sys.block_on(lazy(|| { let _ = sys.block_on(lazy(|| {
let buf = Buffer::new("GET /test HTTP/1\r\n\r\n"); let buf = Buffer::new("GET /test HTTP/1\r\n\r\n");
let mut h1 = Dispatcher::new( let mut h1 = Dispatcher::<_, _, _, _, UpgradeHandler<Buffer>>::new(
buf, buf,
ServiceConfig::default(), ServiceConfig::default(),
CloneableService::new( CloneableService::new(
(|_| ok::<_, Error>(Response::Ok().finish())).into_service(), (|_| ok::<_, Error>(Response::Ok().finish())).into_service(),
), ),
CloneableService::new(ExpectHandler), CloneableService::new(ExpectHandler),
None,
); );
assert!(h1.poll().is_err()); assert!(h1.poll().is_err());
assert!(h1
.inner if let DispatcherState::Normal(ref inner) = h1.inner {
.as_ref() assert!(inner.flags.contains(Flags::READ_DISCONNECT));
.unwrap() assert_eq!(&inner.io.write_buf[..26], b"HTTP/1.1 400 Bad Request\r\n");
.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"
);
ok::<_, ()>(()) ok::<_, ()>(())
})); }));
} }