Update cookie_store dependency (#1268)
* Updated `cookie_store` dependency * Bump `cookie_store` version to `0.14.0` * Add documentation in `cookie` module to direct users to the new `reqwest_cookie_store` crate for more advanced scenarios. * update `cookie` dependency to `0.15` * Update for `cookie_store` `v0.14.1` * Replace usage of deprecated `cookie_store::CookieStore::get_request_cookies` for `cookie_store::CookieStore::get_request_values`. * Update `cookie_store` to `v0.15.0` The deprecation of `get_request_cookies` should have warranted a minor version bump.
This commit is contained in:
@@ -119,8 +119,8 @@ webpki-roots = { version = "0.21", optional = true }
|
|||||||
rustls-native-certs = { version = "0.5", optional = true }
|
rustls-native-certs = { version = "0.5", optional = true }
|
||||||
|
|
||||||
## cookies
|
## cookies
|
||||||
cookie_crate = { version = "0.14", package = "cookie", optional = true }
|
cookie_crate = { version = "0.15", package = "cookie", optional = true }
|
||||||
cookie_store = { version = "0.12", optional = true }
|
cookie_store = { version = "0.15", optional = true }
|
||||||
time = { version = "0.2.11", optional = true }
|
time = { version = "0.2.11", optional = true }
|
||||||
|
|
||||||
## compression
|
## compression
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ pub struct Cookie<'a>(cookie_crate::Cookie<'a>);
|
|||||||
/// This is the implementation used when simply calling `cookie_store(true)`.
|
/// This is the implementation used when simply calling `cookie_store(true)`.
|
||||||
/// This type is exposed to allow creating one and filling it with some
|
/// This type is exposed to allow creating one and filling it with some
|
||||||
/// existing cookies more easily, before creating a `Client`.
|
/// 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)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Jar(RwLock<cookie_store::CookieStore>);
|
pub struct Jar(RwLock<cookie_store::CookieStore>);
|
||||||
|
|
||||||
@@ -88,7 +92,10 @@ impl<'a> Cookie<'a> {
|
|||||||
|
|
||||||
/// The cookie expiration time.
|
/// The cookie expiration time.
|
||||||
pub fn expires(&self) -> Option<SystemTime> {
|
pub fn expires(&self) -> Option<SystemTime> {
|
||||||
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
|
.0
|
||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get_request_cookies(url)
|
.get_request_values(url)
|
||||||
.map(|c| format!("{}={}", c.name(), c.value()))
|
.map(|(name, value)| format!("{}={}", name, value))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join("; ");
|
.join("; ");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user