rs-net-cookie 0.1.0
Parse Cookie and Set-Cookie headers and build them, with attribute handling and percent-encoding
Install
cargo add rs-net-cookie --registry rupm
In Ruststudio: Packages, search for rs-net-cookie, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.
Versions
- 0.1.0 2026-11-23
README
# rs-net-cookie
Parse Cookie and Set-Cookie headers and build them, with attribute handling and percent-encoding
Add it with `rupm add rs-net-cookie` (or `cargo add rs-net-cookie --registry rupm`).
```rust
use rs_net_cookie::{parse_cookie_header, parse_set_cookie, SameSite, SetCookie};
let pairs = parse_cookie_header("a=1; theme=dark");
assert_eq!(pairs[1], ("theme".to_string(), "dark".to_string()));
let mut c = SetCookie::new("sid", "abc123").unwrap();
c.path = Some("/".into());
c.http_only = true;
c.same_site = Some(SameSite::Lax);
assert_eq!(c.to_string(), "sid=abc123; Path=/; HttpOnly; SameSite=Lax");
assert_eq!(parse_set_cookie(&c.to_string()).unwrap(), c);
```