-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTTP::Cookie#destroy
#14819
base: master
Are you sure you want to change the base?
Add HTTP::Cookie#destroy
#14819
Changes from all commits
c012534
1981575
abe3943
564f926
c592330
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -192,6 +192,16 @@ module HTTP | |||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# tell the browser to delete the cookie. | ||||||||||||||||||||||||||||||||
# Set its value to an empty string | ||||||||||||||||||||||||||||||||
# and set its expiration time to the past | ||||||||||||||||||||||||||||||||
# Browsers delete cookies that have expired. | ||||||||||||||||||||||||||||||||
def destroy | ||||||||||||||||||||||||||||||||
self.value = "" | ||||||||||||||||||||||||||||||||
self.expires = Time::UNIX_EPOCH | ||||||||||||||||||||||||||||||||
self.max_age = Time::Span.zero | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
Comment on lines
+195
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate on why you suggest that we remove setting the value to a blank string? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, my reasoning was twofold:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe destroy will better represent what the function does. And there are many methods with a name similar to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clearing the value is not a requirement for expiration. But I think it makes a lot of sense not to send the value you want gone to the client again. |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# :nodoc: | ||||||||||||||||||||||||||||||||
module Parser | ||||||||||||||||||||||||||||||||
module Regex | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Improve wording.