diff --git a/spec/std/http/cookie_spec.cr b/spec/std/http/cookie_spec.cr index 50c37912f14e..f501da15bb84 100644 --- a/spec/std/http/cookie_spec.cr +++ b/spec/std/http/cookie_spec.cr @@ -76,6 +76,7 @@ module HTTP cookie.value.empty?.should be_true cookie.expired?.should be_true + cookie.max_age.should eq(Time::Span.zero) end describe "#name=" do diff --git a/src/http/cookie.cr b/src/http/cookie.cr index a4fe6199eeda..94d0afc0039e 100644 --- a/src/http/cookie.cr +++ b/src/http/cookie.cr @@ -198,7 +198,8 @@ module HTTP # Browsers delete cookies that have expired. def destroy self.value = "" - self.expires = 5.minutes.ago + self.expires = Time::UNIx_EPOCH + self.max_age = Time::Span.zero end # :nodoc: