update tests

This commit is contained in:
Nikolay Kim 2021-12-20 20:49:23 +06:00
parent 72d14dfbcc
commit 50e26f4868

View file

@ -696,7 +696,7 @@ mod tests {
use crate::http::config::{DispatcherConfig, ServiceConfig}; use crate::http::config::{DispatcherConfig, ServiceConfig};
use crate::http::h1::{ClientCodec, ExpectHandler, UpgradeHandler}; use crate::http::h1::{ClientCodec, ExpectHandler, UpgradeHandler};
use crate::http::{body, Request, ResponseHead, StatusCode}; use crate::http::{body, Request, ResponseHead, StatusCode};
use crate::io::{self as nio, DefaultFilter}; use crate::io::{self as nio, Base};
use crate::service::{boxed, fn_service, IntoService}; use crate::service::{boxed, fn_service, IntoService};
use crate::util::{lazy, next, Bytes, BytesMut}; use crate::util::{lazy, next, Bytes, BytesMut};
use crate::{codec::Decoder, testing::Io, time::sleep, time::Millis, time::Seconds}; use crate::{codec::Decoder, testing::Io, time::sleep, time::Millis, time::Seconds};
@ -707,7 +707,7 @@ mod tests {
pub(crate) fn h1<F, S, B>( pub(crate) fn h1<F, S, B>(
stream: Io, stream: Io,
service: F, service: F,
) -> Dispatcher<DefaultFilter, S, B, ExpectHandler, UpgradeHandler<DefaultFilter>> ) -> Dispatcher<Base, S, B, ExpectHandler, UpgradeHandler<Base>>
where where
F: IntoService<S>, F: IntoService<S>,
S: Service<Request = Request>, S: Service<Request = Request>,
@ -741,22 +741,18 @@ mod tests {
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody + 'static, B: MessageBody + 'static,
{ {
crate::rt::spawn(Dispatcher::< crate::rt::spawn(
DefaultFilter, Dispatcher::<Base, S, B, ExpectHandler, UpgradeHandler<Base>>::new(
S, nio::Io::new(stream),
B, Rc::new(DispatcherConfig::new(
ExpectHandler, ServiceConfig::default(),
UpgradeHandler<DefaultFilter>, service.into_service(),
>::new( ExpectHandler,
nio::Io::new(stream), None,
Rc::new(DispatcherConfig::new( None,
ServiceConfig::default(), )),
service.into_service(), ),
ExpectHandler, );
None,
None,
)),
));
} }
fn load(decoder: &mut ClientCodec, buf: &mut BytesMut) -> ResponseHead { fn load(decoder: &mut ClientCodec, buf: &mut BytesMut) -> ResponseHead {
@ -777,7 +773,7 @@ mod tests {
Seconds::ZERO, Seconds::ZERO,
Millis(5_000), Millis(5_000),
); );
let mut h1 = Dispatcher::<_, _, _, _, UpgradeHandler<DefaultFilter>>::new( let mut h1 = Dispatcher::<_, _, _, _, UpgradeHandler<Base>>::new(
nio::Io::new(server), nio::Io::new(server),
Rc::new(DispatcherConfig::new( Rc::new(DispatcherConfig::new(
config, config,