diff --git a/Cargo.toml b/Cargo.toml index bf43b1028..f7e8f91a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ rustls-tls-native-roots = ["rustls-native-certs", "__rustls"] blocking = ["futures-util/io", "tokio/rt-multi-thread", "tokio/sync"] -cookies = ["cookie_crate", "cookie_store", "time"] +cookies = ["cookie_crate", "time"] gzip = ["async-compression", "async-compression/gzip", "tokio-util"] @@ -117,7 +117,7 @@ rustls-native-certs = { version = "0.5", optional = true } ## cookies cookie_crate = { version = "0.14", package = "cookie", optional = true } -cookie_store = { version = "0.12", optional = true } + time = { version = "0.2.11", optional = true } ## compression diff --git a/tests/cookie.rs b/tests/cookie.rs index 072cd1d8f..9fb0770fb 100644 --- a/tests/cookie.rs +++ b/tests/cookie.rs @@ -1,6 +1,10 @@ +use std::sync::Arc; + mod support; use support::*; +use cookie_store::CookieStoreMutex as CookieStore; + #[tokio::test] async fn cookie_response_accessor() { let server = server::http(move |_req| async move { @@ -84,7 +88,7 @@ async fn cookie_store_simple() { }); let client = reqwest::Client::builder() - .cookie_store(true) + .cookie_store(Some(Arc::new(CookieStore::default()))) .build() .unwrap(); @@ -117,7 +121,7 @@ async fn cookie_store_overwrite_existing() { }); let client = reqwest::Client::builder() - .cookie_store(true) + .cookie_store(Some(Arc::new(CookieStore::default()))) .build() .unwrap(); @@ -142,7 +146,7 @@ async fn cookie_store_max_age() { }); let client = reqwest::Client::builder() - .cookie_store(true) + .cookie_store(Some(Arc::new(CookieStore::default()))) .build() .unwrap(); let url = format!("http://{}/", server.addr()); @@ -164,7 +168,7 @@ async fn cookie_store_expires() { }); let client = reqwest::Client::builder() - .cookie_store(true) + .cookie_store(Some(Arc::new(CookieStore::default()))) .build() .unwrap(); @@ -190,7 +194,7 @@ async fn cookie_store_path() { }); let client = reqwest::Client::builder() - .cookie_store(true) + .cookie_store(Some(Arc::new(CookieStore::default()))) .build() .unwrap(); diff --git a/tests/redirect.rs b/tests/redirect.rs index 16f7712f5..1ee8678fb 100644 --- a/tests/redirect.rs +++ b/tests/redirect.rs @@ -1,8 +1,12 @@ #![cfg(not(target_arch = "wasm32"))] +use std::sync::Arc; + mod support; use futures_util::stream::StreamExt; use support::*; +use cookie_store::CookieStoreMutex as CookieStore; + #[tokio::test] async fn test_redirect_301_and_302_and_303_changes_post_to_get() { let client = reqwest::Client::new(); @@ -292,7 +296,7 @@ async fn test_redirect_302_with_set_cookies() { let server = server::http(move |req| async move { if req.uri() == "/302" { http::Response::builder() - .status(302) + .status(code) .header("location", "/dst") .header("set-cookie", "key=value") .body(Default::default()) @@ -308,7 +312,7 @@ async fn test_redirect_302_with_set_cookies() { let dst = format!("http://{}/{}", server.addr(), "dst"); let client = reqwest::ClientBuilder::new() - .cookie_store(true) + .cookie_store(Some(Arc::new(CookieStore::default()))) .build() .unwrap(); let res = client.get(&url).send().await.unwrap();