1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![forbid(unsafe_code)]
#![deny(
    clippy::dbg_macro,
    missing_copy_implementations,
    rustdoc::missing_crate_level_docs,
    missing_debug_implementations,
    missing_docs,
    nonstandard_style,
    unused_qualifications
)]

/*!

# the trillium cookie handler

## example
```
use trillium::Conn;
use trillium_cookies::{cookie::Cookie, CookiesConnExt, CookiesHandler};
async fn handler_that_uses_cookies(conn: Conn) -> Conn {
    let content = if let Some(cookie_value) = conn.cookies().get("some_cookie") {
        format!("current cookie value: {}", cookie_value.value())
    } else {
        String::from("no cookie value set")
    };

    conn.with_cookie(("some_cookie", "some-cookie-value")).ok(content)
}

let handler = (CookiesHandler::new(), handler_that_uses_cookies);

use trillium_testing::prelude::*;

assert_ok!(
    get("/").on(&handler),
    "no cookie value set",
    "set-cookie" => "some_cookie=some-cookie-value"
);

assert_ok!(
    get("/").with_request_header("cookie", "some_cookie=trillium").on(&handler),
    "current cookie value: trillium",
    "set-cookie" => "some_cookie=some-cookie-value"
);

```
*/
mod cookies_handler;
pub use cookies_handler::{cookies, CookiesHandler};

mod cookies_conn_ext;
pub use cookies_conn_ext::CookiesConnExt;

pub use cookie;