mirror of https://github.com/fafhrd91/actix-web
Truncate any nanoseconds from a supplied `Duration` within `Cookie::set_max_age` to ensure two Cookies with the same amount whole seconds equate to one another
This commit is contained in:
parent
7e569bccf6
commit
0eb8d07e84
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue