http_type/cookie/struct.rs
1use crate::*;
2
3/// Builder for constructing HTTP cookies.
4///
5/// Provides methods to set various cookie attributes like expiration,
6/// domain, path, and security flags before building the final cookie string.
7#[derive(Debug, Clone, Default, PartialEq, Eq, Setter, Getter, GetterMut)]
8pub struct CookieBuilder {
9 /// Cookie name identifier.
10 pub(super) name: CookieKey,
11 /// Cookie value content.
12 pub(super) value: CookieValue,
13 /// Expiration date/time string.
14 pub(super) expires: String,
15 /// Maximum age in seconds.
16 pub(super) max_age: i64,
17 /// Domain scope for the cookie.
18 pub(super) domain: String,
19 /// Path scope for the cookie.
20 pub(super) path: String,
21 /// Flag indicating secure (HTTPS-only) transmission.
22 pub(super) secure: bool,
23 /// Flag preventing JavaScript access.
24 pub(super) http_only: bool,
25 /// SameSite policy setting.
26 pub(super) same_site: String,
27}
28
29/// Parser for HTTP Cookie headers.
30///
31/// Provides functionality to parse Cookie header strings into key-value pairs.
32#[derive(Debug, Clone, Default, PartialEq, Eq)]
33pub struct Cookie;