diff --git a/ntex-cors/src/lib.rs b/ntex-cors/src/lib.rs index d38c1b51..27e6d55e 100644 --- a/ntex-cors/src/lib.rs +++ b/ntex-cors/src/lib.rs @@ -787,7 +787,7 @@ where #[cfg(test)] mod tests { - use ntex::service::{fn_service, Container, Middleware}; + use ntex::service::{fn_service, Middleware, Pipeline}; use ntex::web::{self, test, test::TestRequest}; use super::*; @@ -821,7 +821,7 @@ mod tests { #[ntex::test] async fn test_preflight() { - let mut cors: Container<_> = Cors::new() + let mut cors: Pipeline<_> = Cors::new() .send_wildcard() .max_age(3600) .allowed_methods(vec![Method::GET, Method::OPTIONS, Method::POST]) @@ -836,8 +836,8 @@ mod tests { .header(header::ACCESS_CONTROL_REQUEST_HEADERS, "X-Not-Allowed") .to_srv_request(); - assert!(cors.inner.validate_allowed_method(req.head()).is_err()); - assert!(cors.inner.validate_allowed_headers(req.head()).is_err()); + assert!(cors.get_ref().inner.validate_allowed_method(req.head()).is_err()); + assert!(cors.get_ref().inner.validate_allowed_headers(req.head()).is_err()); let resp = test::call_service(&cors, req).await; assert_eq!(resp.status(), StatusCode::BAD_REQUEST); @@ -846,8 +846,8 @@ mod tests { .method(Method::OPTIONS) .to_srv_request(); - assert!(cors.inner.validate_allowed_method(req.head()).is_err()); - assert!(cors.inner.validate_allowed_headers(req.head()).is_ok()); + assert!(cors.get_ref().inner.validate_allowed_method(req.head()).is_err()); + assert!(cors.get_ref().inner.validate_allowed_headers(req.head()).is_ok()); let req = TestRequest::with_header("Origin", "https://www.example.com") .header(header::ACCESS_CONTROL_REQUEST_METHOD, "POST") @@ -905,7 +905,7 @@ mod tests { #[ntex::test] #[should_panic(expected = "OriginNotAllowed")] async fn test_validate_not_allowed_origin() { - let cors: Container<_> = Cors::new() + let cors: Pipeline<_> = Cors::new() .allowed_origin("https://www.example.com") .finish() .create(test::ok_service::()) @@ -914,9 +914,9 @@ mod tests { let req = TestRequest::with_header("Origin", "https://www.unknown.com") .method(Method::GET) .to_srv_request(); - cors.inner.validate_origin(req.head()).unwrap(); - cors.inner.validate_allowed_method(req.head()).unwrap(); - cors.inner.validate_allowed_headers(req.head()).unwrap(); + cors.get_ref().inner.validate_origin(req.head()).unwrap(); + cors.get_ref().inner.validate_allowed_method(req.head()).unwrap(); + cors.get_ref().inner.validate_allowed_headers(req.head()).unwrap(); } #[ntex::test] diff --git a/ntex-files/src/lib.rs b/ntex-files/src/lib.rs index 0d7d4140..b118d60b 100644 --- a/ntex-files/src/lib.rs +++ b/ntex-files/src/lib.rs @@ -1182,7 +1182,7 @@ mod tests { .default_handler(|req: WebRequest| { ok(req.into_response(HttpResponse::Ok().body("default content"))) }) - .container(()) + .pipeline(()) .await .unwrap(); let req = TestRequest::with_uri("/missing").to_srv_request(); diff --git a/ntex-identity/src/lib.rs b/ntex-identity/src/lib.rs index 8d704efc..7f53db15 100644 --- a/ntex-identity/src/lib.rs +++ b/ntex-identity/src/lib.rs @@ -583,7 +583,7 @@ mod tests { use super::*; use ntex::web::test::{self, TestRequest}; use ntex::web::{self, error, App, Error, HttpResponse}; - use ntex::{http::StatusCode, service::into_service, service::Container, time}; + use ntex::{http::StatusCode, service::into_service, service::Pipeline, time}; const COOKIE_KEY_MASTER: [u8; 32] = [0; 32]; const COOKIE_NAME: &str = "ntex_auth"; @@ -700,7 +700,7 @@ mod tests { F: Fn(CookieIdentityPolicy) -> CookieIdentityPolicy + Sync + Send + Clone + 'static, >( f: F, - ) -> Container< + ) -> Pipeline< impl ntex::service::Service, > { test::init_service( @@ -1007,7 +1007,7 @@ mod tests { } } - let srv: Container<_> = IdentityServiceMiddleware { + let srv: Pipeline<_> = IdentityServiceMiddleware { backend: Rc::new(Ident), service: into_service(|_: WebRequest| async move { time::sleep(time::Seconds(100)).await;