chore: upgrade to ntex 2.0 (#14)

* chore: upgrade to ntex 2.0

* bump version to 2.0
This commit is contained in:
leone 2024-05-28 17:38:47 +02:00 committed by GitHub
parent 7034dcc851
commit b89f611c12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 27 additions and 32 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-cors" name = "ntex-cors"
version = "1.0.0" version = "2.0.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Cross-origin resource sharing (CORS) for ntex applications." description = "Cross-origin resource sharing (CORS) for ntex applications."
readme = "README.md" readme = "README.md"
@ -16,9 +16,9 @@ name = "ntex_cors"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
ntex = "1.1" ntex = "2"
derive_more = "0.99" derive_more = "0.99"
futures = "0.3" futures = "0.3"
[dev-dependencies] [dev-dependencies]
ntex = { version = "1.1", features=["tokio"] } ntex = { version = "2", features=["tokio"] }

View file

@ -742,8 +742,8 @@ where
type Response = WebResponse; type Response = WebResponse;
type Error = S::Error; type Error = S::Error;
ntex::forward_poll_ready!(service); ntex::forward_ready!(service);
ntex::forward_poll_shutdown!(service); ntex::forward_shutdown!(service);
async fn call( async fn call(
&self, &self,

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-files" name = "ntex-files"
version = "1.0.0" version = "2.0.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Static files support for ntex web." description = "Static files support for ntex web."
readme = "README.md" readme = "README.md"
@ -18,7 +18,7 @@ name = "ntex_files"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
ntex = "1.1" ntex = "2"
ntex-http = "0.1.12" ntex-http = "0.1.12"
bitflags = "2.1" bitflags = "2.1"
futures = "0.3" futures = "0.3"
@ -34,4 +34,4 @@ language-tags = "0.3"
httpdate = "1.0" httpdate = "1.0"
[dev-dependencies] [dev-dependencies]
ntex = { version = "1.1", features = ["tokio", "openssl", "compress"] } ntex = { version = "2", features = ["tokio", "openssl", "compress"] }

View file

@ -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 /// It may make sense to grow this to include all variants currently
/// registered with IANA, if they are at all common to use. /// 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 { pub enum Method {
/// OPTIONS /// OPTIONS
Options, Options,
/// GET /// GET
#[default]
Get, Get,
/// POST /// POST
Post, Post,
@ -141,12 +142,6 @@ impl fmt::Display for Method {
} }
} }
impl Default for Method {
fn default() -> Method {
Method::Get
}
}
impl From<http::Method> for Method { impl From<http::Method> for Method {
fn from(method: http::Method) -> Method { fn from(method: http::Method) -> Method {
match method { match method {

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-identity" name = "ntex-identity"
version = "1.0.0" version = "2.0.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Identity service for ntex web framework." description = "Identity service for ntex web framework."
readme = "README.md" readme = "README.md"
@ -21,7 +21,7 @@ default = ["cookie-policy"]
cookie-policy = ["cookie/secure", "ntex/cookie"] cookie-policy = ["cookie/secure", "ntex/cookie"]
[dependencies] [dependencies]
ntex = "1.1" ntex = "2"
futures = "0.3" futures = "0.3"
serde = "1.0" serde = "1.0"
serde_json = "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"] } time = { version = "0.3", default-features = false, features = ["std"] }
[dev-dependencies] [dev-dependencies]
ntex = { version = "1.1", features=["tokio"] } ntex = { version = "2", features=["tokio"] }

View file

@ -247,8 +247,8 @@ where
type Response = WebResponse; type Response = WebResponse;
type Error = S::Error; type Error = S::Error;
ntex::forward_poll_ready!(service); ntex::forward_ready!(service);
ntex::forward_poll_shutdown!(service); ntex::forward_shutdown!(service);
async fn call( async fn call(
&self, &self,
@ -571,7 +571,7 @@ mod tests {
use super::*; use super::*;
use ntex::web::test::{self, TestRequest}; use ntex::web::test::{self, TestRequest};
use ntex::web::{self, error, App, Error, HttpResponse}; 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_KEY_MASTER: [u8; 32] = [0; 32];
const COOKIE_NAME: &str = "ntex_auth"; const COOKIE_NAME: &str = "ntex_auth";
@ -973,7 +973,7 @@ mod tests {
#[ntex::test] #[ntex::test]
async fn test_borrowed_mut_error() { async fn test_borrowed_mut_error() {
use futures::future::{lazy, ok, Ready}; use futures::future::{ok, Ready};
use ntex::web::{DefaultError, Error}; use ntex::web::{DefaultError, Error};
struct Ident; struct Ident;
@ -998,7 +998,7 @@ mod tests {
let srv: Pipeline<_> = IdentityServiceMiddleware { let srv: Pipeline<_> = IdentityServiceMiddleware {
backend: Rc::new(Ident), backend: Rc::new(Ident),
service: into_service(|_: WebRequest<DefaultError>| async move { service: fn_service(|_: WebRequest<DefaultError>| async move {
time::sleep(time::Seconds(100)).await; time::sleep(time::Seconds(100)).await;
Err::<WebResponse, _>(error::ErrorBadRequest("error")) Err::<WebResponse, _>(error::ErrorBadRequest("error"))
}), }),
@ -1012,6 +1012,6 @@ mod tests {
}); });
time::sleep(time::Millis(50)).await; time::sleep(time::Millis(50)).await;
let _ = lazy(|cx| srv.poll_ready(cx)).await; srv.ready().await.expect("srv to be ready");
} }
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-multipart" name = "ntex-multipart"
version = "1.0.0" version = "2.0.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Multipart support for ntex web framework." description = "Multipart support for ntex web framework."
readme = "README.md" readme = "README.md"
@ -16,7 +16,7 @@ name = "ntex_multipart"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
ntex = "1.1" ntex = "2"
derive_more = "0.99" derive_more = "0.99"
httparse = "1.3" httparse = "1.3"
futures = "0.3" futures = "0.3"
@ -25,4 +25,4 @@ mime = "0.3"
twoway = "0.2" twoway = "0.2"
[dev-dependencies] [dev-dependencies]
ntex = { version = "1.1", features=["tokio"] } ntex = { version = "2", features=["tokio"] }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-session" name = "ntex-session"
version = "1.0.0" version = "2.0.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Session for ntex web framework." description = "Session for ntex web framework."
readme = "README.md" readme = "README.md"
@ -22,7 +22,7 @@ default = ["cookie-session"]
cookie-session = ["cookie/secure", "ntex/cookie"] cookie-session = ["cookie/secure", "ntex/cookie"]
[dependencies] [dependencies]
ntex = "1.1" ntex = "2"
cookie = "0.18" cookie = "0.18"
derive_more = "0.99" derive_more = "0.99"
futures = "0.3" futures = "0.3"
@ -31,4 +31,4 @@ serde_json = "1.0"
time = { version = "0.3", default-features = false, features = ["std"] } time = { version = "0.3", default-features = false, features = ["std"] }
[dev-dependencies] [dev-dependencies]
ntex = { version = "1.1", features=["tokio"] } ntex = { version = "2", features=["tokio"] }

View file

@ -300,8 +300,8 @@ where
type Response = WebResponse; type Response = WebResponse;
type Error = S::Error; type Error = S::Error;
ntex::forward_poll_ready!(service); ntex::forward_ready!(service);
ntex::forward_poll_shutdown!(service); ntex::forward_shutdown!(service);
/// On first request, a new session cookie is returned in response, regardless /// On first request, a new session cookie is returned in response, regardless
/// of whether any session state is set. With subsequent requests, if the /// of whether any session state is set. With subsequent requests, if the