diff --git a/actix-http/src/cookie/builder.rs b/actix-http/src/cookie/builder.rs index 383c31b1c..c3820abf0 100644 --- a/actix-http/src/cookie/builder.rs +++ b/actix-http/src/cookie/builder.rs @@ -107,7 +107,9 @@ impl CookieBuilder { /// ``` #[inline] pub fn max_age_time(mut self, value: Duration) -> CookieBuilder { - self.cookie.set_max_age(value); + // Truncate any nanoseconds from the Duration, as they aren't represented within `Max-Age` + // and would cause two otherwise identical `Cookie` instances to not be equivalent to one another. + self.cookie.set_max_age(Duration::seconds(value.whole_seconds())); self }