Skip to content

class Athena::Framework::Spec::CookieJar
inherits Reference #

Stores the cookies an ATH::Spec::AbstractBrowser received, sending the matching ones with its subsequent requests.

Cookies are matched against the domain, path, and scheme of the request, and are removed once they expire.

Methods#

#all : Array(::HTTP::Cookie)#

Returns all non-expired cookies.

View source

#all_values(uri : URI) : Hash(String, String)#

Returns the name and value of the most specific cookie of each name that should be sent with a request to the provided uri.

View source

#clear : Nil#

Removes all cookies.

View source

#expire(name : String, path : String | Nil = "/", domain : String | Nil = nil) : Nil#

Removes the cookie with the provided name, path, and domain. Removes it from all domains if domain is nil.

View source

#flush_expired_cookies : Nil#

Removes all expired cookies.

View source

#get(name : String, path : String = "/", domain : String | Nil = nil) : ::HTTP::Cookie | Nil#

Returns the most specific cookie with the provided name that matches the provided path and domain, or nil if there is none.

View source

#set(cookie : ::HTTP::Cookie) : Nil#

Stores the provided cookie, replacing any cookie with the same name, path, and domain.

View source

#update_from_response(response : ::HTTP::Server::Response, uri : URI | Nil = nil) : Nil#

Stores the cookies set by the provided response.

Cookies without a domain or path default to those of the provided uri, and are ignored if they do not match its host.

View source