fix deprecation warning and update multipartr tests

This commit is contained in:
Nikolay Kim 2020-05-12 12:13:22 +06:00
parent 7fdc863607
commit de001b0f25
2 changed files with 3 additions and 3 deletions

View file

@ -1037,7 +1037,7 @@ mod tests {
let mut payload = PayloadBuffer::new(payload);
assert_eq!(payload.buf.len(), 0);
lazy(|cx| payload.poll_stream(cx)).await.unwrap();
assert!(lazy(|cx| payload.poll_stream(cx)).await.is_err());
assert_eq!(None, payload.read_max(1).unwrap());
}

View file

@ -105,7 +105,7 @@ impl<Err> CookieSessionInner<Err> {
}
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 {
@ -136,7 +136,7 @@ impl<Err> CookieSessionInner<Err> {
let mut cookie = Cookie::named(self.name.clone());
cookie.set_value("");
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()).unwrap();
res.headers_mut().append(SET_COOKIE, val);