class Lucky::CookieJar
- Lucky::CookieJar
- Reference
- Object
Included Modules
- Habitat::SettingsHelpers
- Habitat::TempConfig
Defined in:
lucky/cookies/cookie_jar.crConstant Summary
-
HABITAT_SETTINGS =
[{decl: on_set : (HTTP::Cookie -> HTTP::Cookie) | ::Nil, example: nil, validation: nil}] of Nil
-
LUCKY_ENCRYPTION_PREFIX =
(Base64.strict_encode("lucky")) + "--"
-
MAX_COOKIE_SIZE =
4096
Class Method Summary
- .configure(&)
- .empty_jar : Lucky::CookieJar
- .from_request_cookies(cookies : HTTP::Cookies) : Lucky::CookieJar
- .settings
Instance Method Summary
- #[](key : Key) : String
- #[]=(key : Key, value : String) : HTTP::Cookie
- #[]?(key : Key) : String | Nil
-
#clear : Nil
Delete all cookies.
-
#clear(&block : HTTP::Cookie -> ) : Nil
Delete cookies with a block to add specific options.
-
#delete(key : Key) : Nil
https://tools.ietf.org/search/rfc6265#page-8 to remove a cookie, the server returns a Set-Cookie header with an expiration date in the past.
-
#delete(key : Key, &) : Nil
Delete a specific cookie by name
key
. -
#deleted?(key : Key) : Bool
Returns
true
if the cookie has been expired, and has no value. - #get(key : Key) : String
- #get?(key : Key) : String | Nil
- #get_raw(key : Key) : HTTP::Cookie
- #get_raw?(key : Key) : HTTP::Cookie | Nil
- #raw : HTTP::Cookies
- #set(key : Key, value : String) : HTTP::Cookie
- #set_raw(key : Key, value : String) : HTTP::Cookie
- #settings
- #updated : HTTP::Cookies
Class Method Detail
Instance Method Detail
Delete cookies with a block to add specific options.
jar.clear do |cookie| cookie.path("/") .http_only(true) .secure(true) end
https://tools.ietf.org/search/rfc6265#page-8 to remove a cookie, the server returns a Set-Cookie header with an expiration date in the past. The server will be successful in removing the cookie only if the Path and the Domain attribute in the Set-Cookie header match the values used when the cookie was created.
Delete a specific cookie by name key
. Yield that cookie
to the block so you can add additional options like domain, path, etc...
Returns true
if the cookie has been expired, and has no value.
Will return false
if the cookie does not exist, or is valid.