diff --git a/Cargo.toml b/Cargo.toml index 2e86b81..bb2133d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,8 +119,8 @@ webpki-roots = { version = "0.21", optional = true } 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 } +cookie_crate = { version = "0.15", package = "cookie", optional = true } +cookie_store = { version = "0.15", optional = true } time = { version = "0.2.11", optional = true } ## compression diff --git a/src/cookie.rs b/src/cookie.rs index 5bc7ee0..4363301 100644 --- a/src/cookie.rs +++ b/src/cookie.rs @@ -24,6 +24,10 @@ pub struct Cookie<'a>(cookie_crate::Cookie<'a>); /// This is the implementation used when simply calling `cookie_store(true)`. /// This type is exposed to allow creating one and filling it with some /// existing cookies more easily, before creating a `Client`. +/// +/// For more advanced scenarios, such as needing to serialize the store or +/// manipulate it between requests, you may refer to the +/// [reqwest_cookie_store crate](https://crates.io/crates/reqwest_cookie_store). #[derive(Debug, Default)] pub struct Jar(RwLock); @@ -88,7 +92,10 @@ impl<'a> Cookie<'a> { /// The cookie expiration time. pub fn expires(&self) -> Option { - self.0.expires().map(SystemTime::from) + match self.0.expires() { + Some(cookie_crate::Expiration::DateTime(offset)) => Some(SystemTime::from(offset)), + None | Some(cookie_crate::Expiration::Session) => None, + } } } @@ -170,8 +177,8 @@ impl CookieStore for Jar { .0 .read() .unwrap() - .get_request_cookies(url) - .map(|c| format!("{}={}", c.name(), c.value())) + .get_request_values(url) + .map(|(name, value)| format!("{}={}", name, value)) .collect::>() .join("; ");