diff --git a/ntex-cors/Cargo.toml b/ntex-cors/Cargo.toml index c747a7ff..6bf4650f 100644 --- a/ntex-cors/Cargo.toml +++ b/ntex-cors/Cargo.toml @@ -16,9 +16,9 @@ name = "ntex_cors" path = "src/lib.rs" [dependencies] -ntex = "1.1" +ntex = "2" derive_more = "0.99" futures = "0.3" [dev-dependencies] -ntex = { version = "1.1", features=["tokio"] } +ntex = { version = "2", features=["tokio"] } diff --git a/ntex-cors/src/lib.rs b/ntex-cors/src/lib.rs index 5ecb79ef..23fcd580 100644 --- a/ntex-cors/src/lib.rs +++ b/ntex-cors/src/lib.rs @@ -742,8 +742,8 @@ where type Response = WebResponse; type Error = S::Error; - ntex::forward_poll_ready!(service); - ntex::forward_poll_shutdown!(service); + ntex::forward_ready!(service); + ntex::forward_shutdown!(service); async fn call( &self, diff --git a/ntex-files/Cargo.toml b/ntex-files/Cargo.toml index 2eed0317..8040316c 100644 --- a/ntex-files/Cargo.toml +++ b/ntex-files/Cargo.toml @@ -18,7 +18,7 @@ name = "ntex_files" path = "src/lib.rs" [dependencies] -ntex = "1.1" +ntex = "2" ntex-http = "0.1.12" bitflags = "2.1" futures = "0.3" @@ -34,4 +34,4 @@ language-tags = "0.3" httpdate = "1.0" [dev-dependencies] -ntex = { version = "1.1", features = ["tokio", "openssl", "compress"] } +ntex = { version = "2", features = ["tokio", "openssl", "compress"] } diff --git a/ntex-files/src/file_header/method.rs b/ntex-files/src/file_header/method.rs index e4a96889..5bc7259b 100644 --- a/ntex-files/src/file_header/method.rs +++ b/ntex-files/src/file_header/method.rs @@ -13,11 +13,12 @@ use self::Method::{Connect, Delete, Extension, Get, Head, Options, Patch, Post, /// /// It may make sense to grow this to include all variants currently /// registered with IANA, if they are at all common to use. -#[derive(Clone, PartialEq, Eq, Hash, Debug)] +#[derive(Default, Clone, PartialEq, Eq, Hash, Debug)] pub enum Method { /// OPTIONS Options, /// GET + #[default] Get, /// POST Post, @@ -141,12 +142,6 @@ impl fmt::Display for Method { } } -impl Default for Method { - fn default() -> Method { - Method::Get - } -} - impl From for Method { fn from(method: http::Method) -> Method { match method { diff --git a/ntex-identity/Cargo.toml b/ntex-identity/Cargo.toml index a0069c19..ac9569ff 100644 --- a/ntex-identity/Cargo.toml +++ b/ntex-identity/Cargo.toml @@ -21,7 +21,7 @@ default = ["cookie-policy"] cookie-policy = ["cookie/secure", "ntex/cookie"] [dependencies] -ntex = "1.1" +ntex = "2" futures = "0.3" serde = "1.0" serde_json = "1.0" @@ -30,4 +30,4 @@ cookie = { version = "0.18", features = ["private"] } time = { version = "0.3", default-features = false, features = ["std"] } [dev-dependencies] -ntex = { version = "1.1", features=["tokio"] } +ntex = { version = "2", features=["tokio"] } diff --git a/ntex-identity/src/lib.rs b/ntex-identity/src/lib.rs index 15ae8b01..3c385108 100644 --- a/ntex-identity/src/lib.rs +++ b/ntex-identity/src/lib.rs @@ -247,8 +247,8 @@ where type Response = WebResponse; type Error = S::Error; - ntex::forward_poll_ready!(service); - ntex::forward_poll_shutdown!(service); + ntex::forward_ready!(service); + ntex::forward_shutdown!(service); async fn call( &self, @@ -571,7 +571,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::Pipeline, time}; + use ntex::{http::StatusCode, service::fn_service, service::Pipeline, time}; const COOKIE_KEY_MASTER: [u8; 32] = [0; 32]; const COOKIE_NAME: &str = "ntex_auth"; @@ -973,7 +973,7 @@ mod tests { #[ntex::test] async fn test_borrowed_mut_error() { - use futures::future::{lazy, ok, Ready}; + use futures::future::{ok, Ready}; use ntex::web::{DefaultError, Error}; struct Ident; @@ -998,7 +998,7 @@ mod tests { let srv: Pipeline<_> = IdentityServiceMiddleware { backend: Rc::new(Ident), - service: into_service(|_: WebRequest| async move { + service: fn_service(|_: WebRequest| async move { time::sleep(time::Seconds(100)).await; Err::(error::ErrorBadRequest("error")) }), @@ -1012,6 +1012,6 @@ mod tests { }); time::sleep(time::Millis(50)).await; - let _ = lazy(|cx| srv.poll_ready(cx)).await; + srv.ready().await.expect("srv to be ready"); } } diff --git a/ntex-multipart/Cargo.toml b/ntex-multipart/Cargo.toml index 330969b3..487821d5 100644 --- a/ntex-multipart/Cargo.toml +++ b/ntex-multipart/Cargo.toml @@ -16,7 +16,7 @@ name = "ntex_multipart" path = "src/lib.rs" [dependencies] -ntex = "1.1" +ntex = "2" derive_more = "0.99" httparse = "1.3" futures = "0.3" @@ -25,4 +25,4 @@ mime = "0.3" twoway = "0.2" [dev-dependencies] -ntex = { version = "1.1", features=["tokio"] } +ntex = { version = "2", features=["tokio"] } diff --git a/ntex-session/Cargo.toml b/ntex-session/Cargo.toml index 5feeffe7..5bf1ecfd 100644 --- a/ntex-session/Cargo.toml +++ b/ntex-session/Cargo.toml @@ -22,7 +22,7 @@ default = ["cookie-session"] cookie-session = ["cookie/secure", "ntex/cookie"] [dependencies] -ntex = "1.1" +ntex = "2" cookie = "0.18" derive_more = "0.99" futures = "0.3" @@ -31,4 +31,4 @@ serde_json = "1.0" time = { version = "0.3", default-features = false, features = ["std"] } [dev-dependencies] -ntex = { version = "1.1", features=["tokio"] } +ntex = { version = "2", features=["tokio"] } diff --git a/ntex-session/src/cookie.rs b/ntex-session/src/cookie.rs index c7221b60..e738394c 100644 --- a/ntex-session/src/cookie.rs +++ b/ntex-session/src/cookie.rs @@ -300,8 +300,8 @@ where type Response = WebResponse; type Error = S::Error; - ntex::forward_poll_ready!(service); - ntex::forward_poll_shutdown!(service); + ntex::forward_ready!(service); + ntex::forward_shutdown!(service); /// On first request, a new session cookie is returned in response, regardless /// of whether any session state is set. With subsequent requests, if the