Skip to content

Commit

Permalink
set cookie expiry to unix epoch. Set cookie max_age to zero to ensure…
Browse files Browse the repository at this point in the history
… browser deletion
  • Loading branch information
a-alhusaini committed Jul 23, 2024
1 parent abe3943 commit 564f926
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/std/http/cookie_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/http/cookie.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 564f926

Please sign in to comment.