mirror of
https://github.com/actix/actix-web.git
synced 2025-04-13 21:34:06 +00:00
Fix type confusion when using time::parse
followed by using_offset
This commit is contained in:
parent
8d692c0d08
commit
3d622d6012
2 changed files with 5 additions and 5 deletions
|
@ -990,7 +990,7 @@ impl<'a, 'b> PartialEq<Cookie<'b>> for Cookie<'a> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Cookie, SameSite};
|
||||
use time::offset;
|
||||
use time::{offset, PrimitiveDateTime};
|
||||
|
||||
#[test]
|
||||
fn format() {
|
||||
|
@ -1015,7 +1015,7 @@ mod tests {
|
|||
assert_eq!(&cookie.to_string(), "foo=bar; Domain=www.rust-lang.org");
|
||||
|
||||
let time_str = "Wed, 21 Oct 2015 07:28:00 GMT";
|
||||
let expires = time::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC));
|
||||
let expires = PrimitiveDateTime::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC));
|
||||
let cookie = Cookie::build("foo", "bar").expires(expires).finish();
|
||||
assert_eq!(
|
||||
&cookie.to_string(),
|
||||
|
|
|
@ -216,7 +216,7 @@ where
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Cookie, SameSite};
|
||||
use time::{offset, Duration};
|
||||
use time::{offset, Duration, PrimitiveDateTime};
|
||||
|
||||
macro_rules! assert_eq_parse {
|
||||
($string:expr, $expected:expr) => {
|
||||
|
@ -376,7 +376,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let time_str = "Wed, 21 Oct 2015 07:28:00 GMT";
|
||||
let expires = time::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC));
|
||||
let expires = PrimitiveDateTime::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC));
|
||||
expected.set_expires(expires);
|
||||
assert_eq_parse!(
|
||||
" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
|
@ -385,7 +385,7 @@ mod tests {
|
|||
);
|
||||
|
||||
unexpected.set_domain("foo.com");
|
||||
let bad_expires = time::parse(time_str, "%a, %d %b %Y %H:%S:%M").unwrap().using_offset(offset!(UTC));
|
||||
let bad_expires = PrimitiveDateTime::parse(time_str, "%a, %d %b %Y %H:%S:%M").unwrap().using_offset(offset!(UTC));
|
||||
expected.set_expires(bad_expires);
|
||||
assert_ne_parse!(
|
||||
" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
|
|
Loading…
Reference in a new issue