1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 23:51:06 +01:00

bump actix-web to 4.0.0-rc.1

This commit is contained in:
Rob Ede 2022-02-03 22:33:47 +00:00
parent 6abec48e29
commit 323d01fcca
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
27 changed files with 84 additions and 79 deletions

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
- Update `actix-web` dependency to `4.0.0-rc.1`.
## 0.6.0-beta.8 - 2021-12-29 ## 0.6.0-beta.8 - 2021-12-29
@ -8,7 +9,7 @@
## 0.6.0-beta.7 - 2021-12-18 ## 0.6.0-beta.7 - 2021-12-18
- Update `actix-web` dependency to `4.0.0.beta-15`. [#216] - Update `actix-web` dependency to `4.0.0-beta.15`. [#216]
[#216]: https://github.com/actix/actix-extras/pull/216 [#216]: https://github.com/actix/actix-extras/pull/216

View File

@ -19,7 +19,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-service = "2" actix-service = "2"
actix-utils = "3" actix-utils = "3"
actix-web = { version = "4.0.0-beta.17", default-features = false } actix-web = { version = "4.0.0-rc.1", default-features = false }
derive_more = "0.99.5" derive_more = "0.99.5"
futures-util = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false }
@ -28,6 +28,6 @@ once_cell = "1"
smallvec = "1.6.1" smallvec = "1.6.1"
[dev-dependencies] [dev-dependencies]
actix-rt = "2" actix-web = { version = "4.0.0-rc.2", default_features = false, features = ["macros"] }
env_logger = "0.9" env_logger = "0.9"
regex = "1.4" regex = "1.4"

View File

@ -597,7 +597,7 @@ mod test {
.is_err()); .is_err());
} }
#[actix_rt::test] #[actix_web::test]
async fn restrictive_defaults() { async fn restrictive_defaults() {
let cors = Cors::default() let cors = Cors::default()
.new_transform(test::ok_service()) .new_transform(test::ok_service())
@ -612,12 +612,12 @@ mod test {
assert_eq!(resp.status(), StatusCode::BAD_REQUEST); assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
} }
#[actix_rt::test] #[actix_web::test]
async fn allowed_header_try_from() { async fn allowed_header_try_from() {
let _cors = Cors::default().allowed_header("Content-Type"); let _cors = Cors::default().allowed_header("Content-Type");
} }
#[actix_rt::test] #[actix_web::test]
async fn allowed_header_try_into() { async fn allowed_header_try_into() {
struct ContentType; struct ContentType;
@ -632,7 +632,7 @@ mod test {
let _cors = Cors::default().allowed_header(ContentType); let _cors = Cors::default().allowed_header(ContentType);
} }
#[actix_rt::test] #[actix_web::test]
async fn middleware_generic_over_body_type() { async fn middleware_generic_over_body_type() {
let srv = fn_service(|req: ServiceRequest| async move { let srv = fn_service(|req: ServiceRequest| async move {
Ok(req.into_response(HttpResponse::with_body(StatusCode::OK, body::None::new()))) Ok(req.into_response(HttpResponse::with_body(StatusCode::OK, body::None::new())))

View File

@ -218,7 +218,7 @@ mod test {
val.to_str().unwrap() val.to_str().unwrap()
} }
#[actix_rt::test] #[actix_web::test]
async fn test_validate_not_allowed_origin() { async fn test_validate_not_allowed_origin() {
let cors = Cors::default() let cors = Cors::default()
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
@ -236,7 +236,7 @@ mod test {
assert!(cors.inner.validate_allowed_headers(req.head()).is_err()); assert!(cors.inner.validate_allowed_headers(req.head()).is_err());
} }
#[actix_rt::test] #[actix_web::test]
async fn test_preflight() { async fn test_preflight() {
let mut cors = Cors::default() let mut cors = Cors::default()
.allow_any_origin() .allow_any_origin()

View File

@ -195,7 +195,7 @@ mod tests {
use super::*; use super::*;
use crate::Cors; use crate::Cors;
#[actix_rt::test] #[actix_web::test]
async fn test_options_no_origin() { async fn test_options_no_origin() {
// Tests case where allowed_origins is All but there are validate functions to run incase. // Tests case where allowed_origins is All but there are validate functions to run incase.
// In this case, origins are only allowed when the DNT header is sent. // In this case, origins are only allowed when the DNT header is sent.

View File

@ -17,7 +17,7 @@ fn val_as_str(val: &HeaderValue) -> &str {
val.to_str().unwrap() val.to_str().unwrap()
} }
#[actix_rt::test] #[actix_web::test]
#[should_panic] #[should_panic]
async fn test_wildcard_origin() { async fn test_wildcard_origin() {
Cors::default() Cors::default()
@ -27,7 +27,7 @@ async fn test_wildcard_origin() {
.unwrap(); .unwrap();
} }
#[actix_rt::test] #[actix_web::test]
async fn test_not_allowed_origin_fn() { async fn test_not_allowed_origin_fn() {
let cors = Cors::default() let cors = Cors::default()
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
@ -73,7 +73,7 @@ async fn test_not_allowed_origin_fn() {
} }
} }
#[actix_rt::test] #[actix_web::test]
async fn test_allowed_origin_fn() { async fn test_allowed_origin_fn() {
let cors = Cors::default() let cors = Cors::default()
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
@ -118,7 +118,7 @@ async fn test_allowed_origin_fn() {
); );
} }
#[actix_rt::test] #[actix_web::test]
async fn test_allowed_origin_fn_with_environment() { async fn test_allowed_origin_fn_with_environment() {
let regex = Regex::new("https:.+\\.unknown\\.com").unwrap(); let regex = Regex::new("https:.+\\.unknown\\.com").unwrap();
@ -165,7 +165,7 @@ async fn test_allowed_origin_fn_with_environment() {
); );
} }
#[actix_rt::test] #[actix_web::test]
async fn test_multiple_origins_preflight() { async fn test_multiple_origins_preflight() {
let cors = Cors::default() let cors = Cors::default()
.allowed_origin("https://example.com") .allowed_origin("https://example.com")
@ -204,7 +204,7 @@ async fn test_multiple_origins_preflight() {
); );
} }
#[actix_rt::test] #[actix_web::test]
async fn test_multiple_origins() { async fn test_multiple_origins() {
let cors = Cors::default() let cors = Cors::default()
.allowed_origin("https://example.com") .allowed_origin("https://example.com")
@ -239,7 +239,7 @@ async fn test_multiple_origins() {
); );
} }
#[actix_rt::test] #[actix_web::test]
async fn test_response() { async fn test_response() {
let exposed_headers = vec![header::AUTHORIZATION, header::ACCEPT]; let exposed_headers = vec![header::AUTHORIZATION, header::ACCEPT];
let cors = Cors::default() let cors = Cors::default()
@ -340,7 +340,7 @@ async fn test_response() {
assert_eq!(Some("https://www.example.com"), origins_str); assert_eq!(Some("https://www.example.com"), origins_str);
} }
#[actix_rt::test] #[actix_web::test]
async fn test_validate_origin() { async fn test_validate_origin() {
let cors = Cors::default() let cors = Cors::default()
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
@ -356,7 +356,7 @@ async fn test_validate_origin() {
assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.status(), StatusCode::OK);
} }
#[actix_rt::test] #[actix_web::test]
async fn test_no_origin_response() { async fn test_no_origin_response() {
let cors = Cors::permissive() let cors = Cors::permissive()
.disable_preflight() .disable_preflight()
@ -384,7 +384,7 @@ async fn test_no_origin_response() {
); );
} }
#[actix_rt::test] #[actix_web::test]
async fn validate_origin_allows_all_origins() { async fn validate_origin_allows_all_origins() {
let cors = Cors::permissive() let cors = Cors::permissive()
.new_transform(test::ok_service()) .new_transform(test::ok_service())
@ -399,7 +399,7 @@ async fn validate_origin_allows_all_origins() {
assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.status(), StatusCode::OK);
} }
#[actix_rt::test] #[actix_web::test]
async fn test_allow_any_origin_any_method_any_header() { async fn test_allow_any_origin_any_method_any_header() {
let cors = Cors::default() let cors = Cors::default()
.allow_any_origin() .allow_any_origin()

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
- Update `actix-web` dependency to `4.0.0-rc.1`.
## 0.4.0-beta.8 - 2022-01-21 ## 0.4.0-beta.8 - 2022-01-21

View File

@ -16,13 +16,13 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-service = "2" actix-service = "2"
actix-utils = "3" actix-utils = "3"
actix-web = { version = "4.0.0-beta.21", default-features = false, features = ["cookies", "secure-cookies"] } actix-web = { version = "4.0.0-rc.1", default-features = false, features = ["cookies", "secure-cookies"] }
futures-util = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false }
serde = "1.0" serde = { version = "1", features = ["derive"] }
serde_json = "1.0" serde_json = "1"
time = "0.3" time = "0.3"
[dev-dependencies] [dev-dependencies]
actix-http = "3.0.0-beta.15" actix-http = "3.0.0-rc.1"
actix-rt = "2" actix-web = { version = "4.0.0-rc.2", default_features = false, features = ["macros", "cookies", "secure-cookies"] }

View File

@ -455,7 +455,7 @@ mod tests {
} }
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_flow() { async fn test_identity_flow() {
let srv = test::init_service( let srv = test::init_service(
App::new() App::new()
@ -514,7 +514,7 @@ mod tests {
assert!(resp.headers().contains_key(header::SET_COOKIE)) assert!(resp.headers().contains_key(header::SET_COOKIE))
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_max_age_time() { async fn test_identity_max_age_time() {
let duration = Duration::days(1); let duration = Duration::days(1);
@ -542,7 +542,7 @@ mod tests {
assert_eq!(duration, c.max_age().unwrap()); assert_eq!(duration, c.max_age().unwrap());
} }
#[actix_rt::test] #[actix_web::test]
async fn test_http_only_same_site() { async fn test_http_only_same_site() {
let srv = test::init_service( let srv = test::init_service(
App::new() App::new()
@ -610,7 +610,7 @@ mod tests {
assert!(cookies.get(COOKIE_NAME).is_none()); assert!(cookies.get(COOKIE_NAME).is_none());
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_max_age() { async fn test_identity_max_age() {
let seconds = 60; let seconds = 60;
let srv = test::init_service( let srv = test::init_service(
@ -636,7 +636,7 @@ mod tests {
assert_eq!(Duration::seconds(seconds as i64), c.max_age().unwrap()); assert_eq!(Duration::seconds(seconds as i64), c.max_age().unwrap());
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_legacy_cookie_is_set() { async fn test_identity_legacy_cookie_is_set() {
let srv = create_identity_server(|c| c).await; let srv = create_identity_server(|c| c).await;
let mut resp = test::call_service(&srv, TestRequest::with_uri("/").to_request()).await; let mut resp = test::call_service(&srv, TestRequest::with_uri("/").to_request()).await;
@ -644,7 +644,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_legacy_cookie_works() { async fn test_identity_legacy_cookie_works() {
let srv = create_identity_server(|c| c).await; let srv = create_identity_server(|c| c).await;
let cookie = legacy_login_cookie(COOKIE_LOGIN); let cookie = legacy_login_cookie(COOKIE_LOGIN);
@ -659,7 +659,7 @@ mod tests {
assert_logged_in(resp, Some(COOKIE_LOGIN)).await; assert_logged_in(resp, Some(COOKIE_LOGIN)).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_legacy_cookie_rejected_if_visit_timestamp_needed() { async fn test_identity_legacy_cookie_rejected_if_visit_timestamp_needed() {
let srv = create_identity_server(|c| c.visit_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.visit_deadline(Duration::days(90))).await;
let cookie = legacy_login_cookie(COOKIE_LOGIN); let cookie = legacy_login_cookie(COOKIE_LOGIN);
@ -679,7 +679,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_legacy_cookie_rejected_if_login_timestamp_needed() { async fn test_identity_legacy_cookie_rejected_if_login_timestamp_needed() {
let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await;
let cookie = legacy_login_cookie(COOKIE_LOGIN); let cookie = legacy_login_cookie(COOKIE_LOGIN);
@ -699,7 +699,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_cookie_rejected_if_login_timestamp_needed() { async fn test_identity_cookie_rejected_if_login_timestamp_needed() {
let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await;
let cookie = login_cookie(COOKIE_LOGIN, None, Some(SystemTime::now())); let cookie = login_cookie(COOKIE_LOGIN, None, Some(SystemTime::now()));
@ -719,7 +719,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_cookie_rejected_if_visit_timestamp_needed() { async fn test_identity_cookie_rejected_if_visit_timestamp_needed() {
let srv = create_identity_server(|c| c.visit_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.visit_deadline(Duration::days(90))).await;
let cookie = login_cookie(COOKIE_LOGIN, Some(SystemTime::now()), None); let cookie = login_cookie(COOKIE_LOGIN, Some(SystemTime::now()), None);
@ -739,7 +739,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_cookie_rejected_if_login_timestamp_too_old() { async fn test_identity_cookie_rejected_if_login_timestamp_too_old() {
let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await;
let cookie = login_cookie( let cookie = login_cookie(
@ -763,7 +763,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_cookie_rejected_if_visit_timestamp_too_old() { async fn test_identity_cookie_rejected_if_visit_timestamp_too_old() {
let srv = create_identity_server(|c| c.visit_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.visit_deadline(Duration::days(90))).await;
let cookie = login_cookie( let cookie = login_cookie(
@ -787,7 +787,7 @@ mod tests {
assert_logged_in(resp, None).await; assert_logged_in(resp, None).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_cookie_not_updated_on_login_deadline() { async fn test_identity_cookie_not_updated_on_login_deadline() {
let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await; let srv = create_identity_server(|c| c.login_deadline(Duration::days(90))).await;
let cookie = login_cookie(COOKIE_LOGIN, Some(SystemTime::now()), None); let cookie = login_cookie(COOKIE_LOGIN, Some(SystemTime::now()), None);
@ -802,7 +802,7 @@ mod tests {
assert_logged_in(resp, Some(COOKIE_LOGIN)).await; assert_logged_in(resp, Some(COOKIE_LOGIN)).await;
} }
#[actix_rt::test] #[actix_web::test]
async fn test_identity_cookie_updated_on_visit_deadline() { async fn test_identity_cookie_updated_on_visit_deadline() {
let srv = create_identity_server(|c| { let srv = create_identity_server(|c| {
c.visit_deadline(Duration::days(90)) c.visit_deadline(Duration::days(90))

View File

@ -127,7 +127,7 @@ mod tests {
use super::*; use super::*;
#[actix_rt::test] #[actix_web::test]
async fn test_borrowed_mut_error() { async fn test_borrowed_mut_error() {
use actix_utils::future::{ok, Ready}; use actix_utils::future::{ok, Ready};
use futures_util::future::lazy; use futures_util::future::lazy;
@ -154,7 +154,7 @@ mod tests {
let srv = crate::middleware::IdentityServiceMiddleware { let srv = crate::middleware::IdentityServiceMiddleware {
backend: Rc::new(Ident), backend: Rc::new(Ident),
service: Rc::new(into_service(|_: dev::ServiceRequest| async move { service: Rc::new(into_service(|_: dev::ServiceRequest| async move {
actix_rt::time::sleep(Duration::from_secs(100)).await; actix_web::rt::time::sleep(Duration::from_secs(100)).await;
Err::<dev::ServiceResponse, _>(error::ErrorBadRequest("error")) Err::<dev::ServiceResponse, _>(error::ErrorBadRequest("error"))
})), })),
}; };
@ -162,11 +162,11 @@ mod tests {
let srv2 = srv.clone(); let srv2 = srv.clone();
let req = test::TestRequest::default().to_srv_request(); let req = test::TestRequest::default().to_srv_request();
actix_rt::spawn(async move { actix_web::rt::spawn(async move {
let _ = srv2.call(req).await; let _ = srv2.call(req).await;
}); });
actix_rt::time::sleep(Duration::from_millis(50)).await; actix_web::rt::time::sleep(Duration::from_millis(50)).await;
let _ = lazy(|cx| srv.poll_ready(cx)).await; let _ = lazy(|cx| srv.poll_ready(cx)).await;
} }

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
- Update `actix-web` dependency to `4.0.0-rc.1`.
## 0.7.0-beta.5 - 2022-02-03 ## 0.7.0-beta.5 - 2022-02-03

View File

@ -18,11 +18,11 @@ name = "actix_protobuf"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
actix-rt = "2" actix-web = { version = "4.0.0-rc.1", default_features = false }
actix-web = { version = "4.0.0-beta.17", default_features = false }
derive_more = "0.99.5" derive_more = "0.99.5"
futures-util = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false }
prost = { version = "0.9", default_features = false } prost = { version = "0.9", default_features = false }
[dev-dependencies] [dev-dependencies]
actix-web = { version = "4.0.0-rc.2", default_features = false, features = ["macros"] }
prost = { version = "0.9", default_features = false, features = ["prost-derive"] } prost = { version = "0.9", default_features = false, features = ["prost-derive"] }

View File

@ -8,7 +8,7 @@ authors = [
] ]
[dependencies] [dependencies]
actix-web = "4.0.0-beta.17" actix-web = "4.0.0-rc.2"
actix-protobuf = { path = "../../" } actix-protobuf = { path = "../../" }
env_logger = "0.8" env_logger = "0.8"

View File

@ -294,19 +294,19 @@ mod tests {
pub name: String, pub name: String,
} }
#[actix_rt::test] #[actix_web::test]
async fn test_protobuf() { async fn test_protobuf() {
let protobuf = ProtoBuf(MyObject { let protobuf = ProtoBuf(MyObject {
number: 9, number: 9,
name: "test".to_owned(), name: "test".to_owned(),
}); });
let req = TestRequest::default().to_http_request(); let req = TestRequest::default().to_http_request();
let resp = protobuf.respond_to(&req).await.unwrap(); let resp = protobuf.respond_to(&req);
let ct = resp.headers().get(header::CONTENT_TYPE).unwrap(); let ct = resp.headers().get(header::CONTENT_TYPE).unwrap();
assert_eq!(ct, "application/protobuf"); assert_eq!(ct, "application/protobuf");
} }
#[actix_rt::test] #[actix_web::test]
async fn test_protobuf_message() { async fn test_protobuf_message() {
let (req, mut pl) = TestRequest::default().to_http_parts(); let (req, mut pl) = TestRequest::default().to_http_parts();
let protobuf = ProtoBufMessage::<MyObject>::new(&req, &mut pl).await; let protobuf = ProtoBufMessage::<MyObject>::new(&req, &mut pl).await;

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
- Update `actix-web` dependency to `4.0.0-rc.1`.
## 0.10.0-beta.5 - 2021-12-29 ## 0.10.0-beta.5 - 2021-12-29

View File

@ -30,7 +30,6 @@ web = [
[dependencies] [dependencies]
actix = { version = "0.12.0", default-features = false } actix = { version = "0.12.0", default-features = false }
actix-rt = { version = "2.1", default-features = false }
actix-service = "2.0.0" actix-service = "2.0.0"
actix-tls = { version = "3.0.0-rc.2", default-features = false, features = ["connect"] } actix-tls = { version = "3.0.0-rc.2", default-features = false, features = ["connect"] }
@ -45,15 +44,15 @@ tokio = { version = "1.13.1", features = ["sync"] }
tokio-util = "0.6.1" tokio-util = "0.6.1"
# actix-session # actix-session
actix-web = { version = "4.0.0-beta.18", default_features = false, optional = true } actix-web = { version = "4.0.0-rc.1", default_features = false, optional = true }
actix-session = { version = "0.5.0-beta.7", optional = true } actix-session = { version = "0.5.0-beta.7", optional = true }
rand = { version = "0.8.0", optional = true } rand = { version = "0.8.0", optional = true }
serde = { version = "1.0.101", optional = true } serde = { version = "1.0.101", optional = true }
serde_json = { version = "1.0.40", optional = true } serde_json = { version = "1.0.40", optional = true }
[dev-dependencies] [dev-dependencies]
actix-test = "0.1.0-beta.10" actix-test = "0.1.0-beta.12"
actix-rt = "2.1" actix-web = { version = "4.0.0-rc.2", default_features = false, features = ["macros"] }
env_logger = "0.9" env_logger = "0.9"
serde = { version = "1.0.101", features = ["derive"] } serde = { version = "1.0.101", features = ["derive"] }

View File

@ -68,7 +68,7 @@ async fn secret(session: Session) -> Result<impl Responder, Error> {
Ok("secret revealed") Ok("secret revealed")
} }
#[actix_rt::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info,actix_redis=info"); std::env::set_var("RUST_LOG", "actix_web=info,actix_redis=info");
env_logger::init(); env_logger::init();

View File

@ -17,7 +17,7 @@ async fn index(req: HttpRequest, session: Session) -> Result<impl Responder, Err
Ok("Welcome!") Ok("Welcome!")
} }
#[actix_rt::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info,actix_redis=info"); std::env::set_var("RUST_LOG", "actix_web=info,actix_redis=info");
env_logger::init(); env_logger::init();

View File

@ -2,9 +2,9 @@ use std::collections::VecDeque;
use std::io; use std::io;
use actix::prelude::*; use actix::prelude::*;
use actix_rt::net::TcpStream;
use actix_service::boxed::{self, BoxService}; use actix_service::boxed::{self, BoxService};
use actix_tls::connect::{ConnectError, ConnectInfo, Connection, ConnectorService}; use actix_tls::connect::{ConnectError, ConnectInfo, Connection, ConnectorService};
use actix_web::rt::net::TcpStream;
use backoff::backoff::Backoff; use backoff::backoff::Backoff;
use backoff::ExponentialBackoff; use backoff::ExponentialBackoff;
use log::{error, info, warn}; use log::{error, info, warn};

View File

@ -447,7 +447,7 @@ mod test {
Ok(HttpResponse::Ok().body(body)) Ok(HttpResponse::Ok().body(body))
} }
#[actix_rt::test] #[actix_web::test]
async fn test_session_workflow() { async fn test_session_workflow() {
// Step 1: GET index // Step 1: GET index
// - set-cookie actix-session should NOT be in response (session data is empty) // - set-cookie actix-session should NOT be in response (session data is empty)
@ -653,7 +653,7 @@ mod test {
); );
} }
#[actix_rt::test] #[actix_web::test]
async fn test_max_age_session_only() { async fn test_max_age_session_only() {
// //
// Test that removing max_age results in a session-only cookie // Test that removing max_age results in a session-only cookie

View File

@ -3,7 +3,7 @@ extern crate redis_async;
use actix_redis::{Command, Error, RedisActor, RespValue}; use actix_redis::{Command, Error, RedisActor, RespValue};
#[actix_rt::test] #[actix_web::test]
async fn test_error_connect() { async fn test_error_connect() {
let addr = RedisActor::start("localhost:54000"); let addr = RedisActor::start("localhost:54000");
let _addr2 = addr.clone(); let _addr2 = addr.clone();
@ -15,7 +15,7 @@ async fn test_error_connect() {
} }
} }
#[actix_rt::test] #[actix_web::test]
async fn test_redis() { async fn test_redis() {
env_logger::init(); env_logger::init();

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
- Update `actix-web` dependency to `4.0.0-rc.1`.
## 0.5.0-beta.7 - 2021-12-29 ## 0.5.0-beta.7 - 2021-12-29

View File

@ -20,7 +20,7 @@ cookie-session = ["actix-web/secure-cookies"]
[dependencies] [dependencies]
actix-service = "2" actix-service = "2"
actix-utils = "3" actix-utils = "3"
actix-web = { version = "4.0.0-beta.18", default_features = false, features = ["cookies"] } actix-web = { version = "4.0.0-rc.1", default_features = false, features = ["cookies"] }
derive_more = "0.99.5" derive_more = "0.99.5"
futures-util = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false }
@ -30,4 +30,4 @@ serde_json = "1.0"
time = "0.3" time = "0.3"
[dev-dependencies] [dev-dependencies]
actix-rt = "2" actix-web = { version = "4.0.0-rc.2", default_features = false, features = ["macros", "cookies"] }

View File

@ -393,7 +393,7 @@ mod tests {
use actix_web::web::Bytes; use actix_web::web::Bytes;
use actix_web::{test, web, App}; use actix_web::{test, web, App};
#[actix_rt::test] #[actix_web::test]
async fn cookie_session() { async fn cookie_session() {
let app = test::init_service( let app = test::init_service(
App::new() App::new()
@ -413,7 +413,7 @@ mod tests {
.any(|c| c.name() == "actix-session")); .any(|c| c.name() == "actix-session"));
} }
#[actix_rt::test] #[actix_web::test]
async fn private_cookie() { async fn private_cookie() {
let app = test::init_service( let app = test::init_service(
App::new() App::new()
@ -433,7 +433,7 @@ mod tests {
.any(|c| c.name() == "actix-session")); .any(|c| c.name() == "actix-session"));
} }
#[actix_rt::test] #[actix_web::test]
async fn lazy_cookie() { async fn lazy_cookie() {
let app = test::init_service( let app = test::init_service(
App::new() App::new()
@ -459,7 +459,7 @@ mod tests {
.any(|c| c.name() == "actix-session")); .any(|c| c.name() == "actix-session"));
} }
#[actix_rt::test] #[actix_web::test]
async fn cookie_session_extractor() { async fn cookie_session_extractor() {
let app = test::init_service( let app = test::init_service(
App::new() App::new()
@ -479,7 +479,7 @@ mod tests {
.any(|c| c.name() == "actix-session")); .any(|c| c.name() == "actix-session"));
} }
#[actix_rt::test] #[actix_web::test]
async fn basics() { async fn basics() {
let app = test::init_service( let app = test::init_service(
App::new() App::new()
@ -520,7 +520,7 @@ mod tests {
assert_eq!(body, Bytes::from_static(b"counter: 100")); assert_eq!(body, Bytes::from_static(b"counter: 100"));
} }
#[actix_rt::test] #[actix_web::test]
async fn prolong_expiration() { async fn prolong_expiration() {
let app = test::init_service( let app = test::init_service(
App::new() App::new()
@ -545,7 +545,7 @@ mod tests {
.datetime() .datetime()
.expect("Expiration is a datetime"); .expect("Expiration is a datetime");
actix_rt::time::sleep(std::time::Duration::from_secs(1)).await; actix_web::rt::time::sleep(std::time::Duration::from_secs(1)).await;
let request = test::TestRequest::with_uri("/test/").to_request(); let request = test::TestRequest::with_uri("/test/").to_request();
let response = app.call(request).await.unwrap(); let response = app.call(request).await.unwrap();

View File

@ -1,6 +1,7 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
- Update `actix-web` dependency to `4.0.0-rc.1`.
## 0.6.0-beta.7 - 2021-12-29 ## 0.6.0-beta.7 - 2021-12-29

View File

@ -20,7 +20,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-service = "2" actix-service = "2"
actix-utils = "3" actix-utils = "3"
actix-web = { version = "4.0.0-beta.17", default_features = false } actix-web = { version = "4.0.0-rc.1", default_features = false }
base64 = "0.13" base64 = "0.13"
futures-util = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false }
@ -29,4 +29,4 @@ pin-project-lite = "0.2.7"
[dev-dependencies] [dev-dependencies]
actix-cors = "0.6.0-beta.8" actix-cors = "0.6.0-beta.8"
actix-rt = "2" actix-web = { version = "4.0.0-rc.2", default_features = false, features = ["macros"] }

View File

@ -248,11 +248,11 @@ mod tests {
use actix_web::{error, HttpResponse}; use actix_web::{error, HttpResponse};
/// This is a test for https://github.com/actix/actix-extras/issues/10 /// This is a test for https://github.com/actix/actix-extras/issues/10
#[actix_rt::test] #[actix_web::test]
async fn test_middleware_panic() { async fn test_middleware_panic() {
let middleware = AuthenticationMiddleware { let middleware = AuthenticationMiddleware {
service: Rc::new(into_service(|_: ServiceRequest| async move { service: Rc::new(into_service(|_: ServiceRequest| async move {
actix_rt::time::sleep(std::time::Duration::from_secs(1)).await; actix_web::rt::time::sleep(std::time::Duration::from_secs(1)).await;
Err::<ServiceResponse, _>(error::ErrorBadRequest("error")) Err::<ServiceResponse, _>(error::ErrorBadRequest("error"))
})), })),
process_fn: Arc::new(|req, _: BearerAuth| async { Ok(req) }), process_fn: Arc::new(|req, _: BearerAuth| async { Ok(req) }),
@ -271,11 +271,11 @@ mod tests {
} }
/// This is a test for https://github.com/actix/actix-extras/issues/10 /// This is a test for https://github.com/actix/actix-extras/issues/10
#[actix_rt::test] #[actix_web::test]
async fn test_middleware_panic_several_orders() { async fn test_middleware_panic_several_orders() {
let middleware = AuthenticationMiddleware { let middleware = AuthenticationMiddleware {
service: Rc::new(into_service(|_: ServiceRequest| async move { service: Rc::new(into_service(|_: ServiceRequest| async move {
actix_rt::time::sleep(std::time::Duration::from_secs(1)).await; actix_web::rt::time::sleep(std::time::Duration::from_secs(1)).await;
Err::<ServiceResponse, _>(error::ErrorBadRequest("error")) Err::<ServiceResponse, _>(error::ErrorBadRequest("error"))
})), })),
process_fn: Arc::new(|req, _: BearerAuth| async { Ok(req) }), process_fn: Arc::new(|req, _: BearerAuth| async { Ok(req) }),
@ -307,7 +307,7 @@ mod tests {
assert!(f3.is_err()); assert!(f3.is_err());
} }
#[actix_rt::test] #[actix_web::test]
async fn test_middleware_opt_extractor() { async fn test_middleware_opt_extractor() {
let middleware = AuthenticationMiddleware { let middleware = AuthenticationMiddleware {
service: Rc::new(into_service(|req: ServiceRequest| async move { service: Rc::new(into_service(|req: ServiceRequest| async move {
@ -331,7 +331,7 @@ mod tests {
assert!(f.is_ok()); assert!(f.is_ok());
} }
#[actix_rt::test] #[actix_web::test]
async fn test_middleware_res_extractor() { async fn test_middleware_res_extractor() {
let middleware = AuthenticationMiddleware { let middleware = AuthenticationMiddleware {
service: Rc::new(into_service(|req: ServiceRequest| async move { service: Rc::new(into_service(|req: ServiceRequest| async move {