pub struct CookieJar {
pub cookies: Vec<Cookie>,
}Expand description
A jar for collecting and managing cookies across requests and responses.
Fields§
Implementations§
Source§impl CookieJar
impl CookieJar
Sourcepub fn insert(&mut self, cookie: Cookie)
pub fn insert(&mut self, cookie: Cookie)
Add or replace a cookie in the jar (keyed by name only, for backward compat).
Sourcepub fn remove(&mut self, name: &str) -> Option<Cookie>
pub fn remove(&mut self, name: &str) -> Option<Cookie>
Remove a cookie by name. Returns the removed cookie if it existed.
Build a Cookie header value from all cookies in the jar.
Parse cookies from multiple Set-Cookie header values and add them to the jar.
Sourcepub fn insert_for_url(&mut self, cookie: Cookie, request_url: &Uri)
pub fn insert_for_url(&mut self, cookie: Cookie, request_url: &Uri)
Insert a cookie with URL context for default domain/path assignment and expiry computation.
Returns cookies matching the given URL per RFC 6265 §5.4. Filters by domain-match, path-match, secure, and expiry. Result is sorted by path length descending.
Build a Cookie header value for the given URL, or None if no cookies match.
Sourcepub fn add_from_response_headers(&mut self, headers: &HeaderMap, url: &Uri)
pub fn add_from_response_headers(&mut self, headers: &HeaderMap, url: &Uri)
Parse all Set-Cookie headers from an http::HeaderMap and insert them
with URL context for default domain/path and expiry computation.