mirror of
https://github.com/actix/actix-extras.git
synced 2025-01-22 23:05:56 +01:00
Replace deprecated methods with now_utc()
This commit is contained in:
parent
6b5215d439
commit
446b920d96
@ -360,7 +360,7 @@ impl Inner {
|
|||||||
let mut cookie = Cookie::named(self.name.clone());
|
let mut cookie = Cookie::named(self.name.clone());
|
||||||
cookie.set_value("");
|
cookie.set_value("");
|
||||||
cookie.set_max_age(Duration::zero());
|
cookie.set_max_age(Duration::zero());
|
||||||
cookie.set_expires(OffsetDateTime::now() - Duration::days(365));
|
cookie.set_expires(OffsetDateTime::now_utc() - Duration::days(365));
|
||||||
|
|
||||||
let val = HeaderValue::from_str(&cookie.to_string())
|
let val = HeaderValue::from_str(&cookie.to_string())
|
||||||
.map_err(error::ErrorInternalServerError)?;
|
.map_err(error::ErrorInternalServerError)?;
|
||||||
@ -638,7 +638,7 @@ mod test {
|
|||||||
.find(|c| c.name() == "test-session")
|
.find(|c| c.name() == "test-session")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
OffsetDateTime::now().year(),
|
OffsetDateTime::now_utc().year(),
|
||||||
cookie_4.expires().map(|t| t.year()).unwrap()
|
cookie_4.expires().map(|t| t.year()).unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ impl CookieSessionInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(expires_in) = self.expires_in {
|
if let Some(expires_in) = self.expires_in {
|
||||||
cookie.set_expires(OffsetDateTime::now() + expires_in);
|
cookie.set_expires(OffsetDateTime::now_utc() + expires_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(max_age) = self.max_age {
|
if let Some(max_age) = self.max_age {
|
||||||
@ -131,7 +131,7 @@ impl CookieSessionInner {
|
|||||||
let mut cookie = Cookie::named(self.name.clone());
|
let mut cookie = Cookie::named(self.name.clone());
|
||||||
cookie.set_value("");
|
cookie.set_value("");
|
||||||
cookie.set_max_age(Duration::zero());
|
cookie.set_max_age(Duration::zero());
|
||||||
cookie.set_expires(OffsetDateTime::now() - Duration::days(365));
|
cookie.set_expires(OffsetDateTime::now_utc() - Duration::days(365));
|
||||||
|
|
||||||
let val = HeaderValue::from_str(&cookie.to_string())?;
|
let val = HeaderValue::from_str(&cookie.to_string())?;
|
||||||
res.headers_mut().append(SET_COOKIE, val);
|
res.headers_mut().append(SET_COOKIE, val);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user