mirror of https://github.com/fafhrd91/actix-web
Fix type confusion when using `time::parse` followed by `using_offset`
This commit is contained in:
parent
8d692c0d08
commit
3d622d6012
|
@ -990,7 +990,7 @@ impl<'a, 'b> PartialEq<Cookie<'b>> for Cookie<'a> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{Cookie, SameSite};
|
use super::{Cookie, SameSite};
|
||||||
use time::offset;
|
use time::{offset, PrimitiveDateTime};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format() {
|
fn format() {
|
||||||
|
@ -1015,7 +1015,7 @@ mod tests {
|
||||||
assert_eq!(&cookie.to_string(), "foo=bar; Domain=www.rust-lang.org");
|
assert_eq!(&cookie.to_string(), "foo=bar; Domain=www.rust-lang.org");
|
||||||
|
|
||||||
let time_str = "Wed, 21 Oct 2015 07:28:00 GMT";
|
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();
|
let cookie = Cookie::build("foo", "bar").expires(expires).finish();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&cookie.to_string(),
|
&cookie.to_string(),
|
||||||
|
|
|
@ -216,7 +216,7 @@ where
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{Cookie, SameSite};
|
use super::{Cookie, SameSite};
|
||||||
use time::{offset, Duration};
|
use time::{offset, Duration, PrimitiveDateTime};
|
||||||
|
|
||||||
macro_rules! assert_eq_parse {
|
macro_rules! assert_eq_parse {
|
||||||
($string:expr, $expected:expr) => {
|
($string:expr, $expected:expr) => {
|
||||||
|
@ -376,7 +376,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
let time_str = "Wed, 21 Oct 2015 07:28:00 GMT";
|
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);
|
expected.set_expires(expires);
|
||||||
assert_eq_parse!(
|
assert_eq_parse!(
|
||||||
" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||||
|
@ -385,7 +385,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
unexpected.set_domain("foo.com");
|
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);
|
expected.set_expires(bad_expires);
|
||||||
assert_ne_parse!(
|
assert_ne_parse!(
|
||||||
" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||||
|
|
Loading…
Reference in New Issue