pub struct Cookie {
pub host: String,
pub path: String,
pub name: String,
pub value: String,
pub is_secure: bool,
pub is_http_only: bool,
pub creation_time: OffsetDateTime,
pub expiration_time: Option<OffsetDateTime>,
pub same_site: Option<SameSite>,
pub last_accessed: Option<OffsetDateTime>,
}Expand description
A single HTTP cookie.
Fields§
§host: StringThe host (domain) with which the cookie is associated.
path: StringThe path under which the cookie should be used when making requests.
name: StringThe name of the cookie.
value: StringThe contents of the cookie.
is_secure: boolWhether the cookie should only be sent over encrypted channels (https).
is_http_only: boolWhether the cookie should be hidden from client-side scripting (javascript).
creation_time: OffsetDateTimeWhen the cookie was first registered with the browser.
expiration_time: Option<OffsetDateTime>When the cookie will no longer be valid.
same_site: Option<SameSite>The SameSite setting for the cookie (which may not have been specified).
last_accessed: Option<OffsetDateTime>The last time the cookie was accessed by the browser (if this data is tracked).
Implementations§
Source§impl Cookie
impl Cookie
Crafts a Set-Cookie header value corresponding to this cookie.
Sourcepub fn get_url(&self) -> String
pub fn get_url(&self) -> String
Creates a URL that could have feasibly responded with this cookie as a Set-Cookie header.
This URL is a guess based on the cookie’s domain and path; there is no guarantee that calls to this URL will set this cookie, or even that this URL will respond successfully.