1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-21 13:15:38 +02:00

dispatcher internals testing (#1840)

This commit is contained in:
Rob Ede
2020-12-23 01:28:17 +00:00
committed by GitHub
parent 05f104c240
commit 2a7f2c1d59
8 changed files with 519 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
use std::task::{Context, Poll};
use actix_service::{Service, ServiceFactory};
use futures_util::future::{ok, Ready};
use futures_util::future::{ready, Ready};
use crate::error::Error;
use crate::request::Request;
@@ -17,8 +17,8 @@ impl ServiceFactory for ExpectHandler {
type InitError = Error;
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(ExpectHandler)
fn new_service(&self, _: Self::Config) -> Self::Future {
ready(Ok(ExpectHandler))
}
}
@@ -33,6 +33,8 @@ impl Service for ExpectHandler {
}
fn call(&mut self, req: Request) -> Self::Future {
ok(req)
ready(Ok(req))
// TODO: add some way to trigger error
// Err(error::ErrorExpectationFailed("test"))
}
}