pavex/cookie/mod.rs
1//! Everything you need to work with HTTP cookies.
2//!
3//! # Guide
4//!
5//! Check out the ["Cookies"](https://pavex.dev/guide/cookies/)
6//! section of Pavex's guide for a thorough introduction to cookies.
7//!
8//! # Implementation details
9//!
10//! Most types and functions are re-exports of the
11//! [`[email protected]`](https://docs.rs/biscotti/0.3) crate.
12// Everything from `biscotti`, except:
13// - the `time` module, which is re-exported as a top-level module in Pavex itself
14// - `ResponseCookies`, which is customized in the `response_cookies` module
15// - the `errors` module, which is augmented with additional error types in the `errors` module
16// - the `response` module, which is replaced with a wrapped version in the `response` module
17#[crate::config(key = "cookies", default_if_missing, pavex = crate)]
18pub use biscotti::ProcessorConfig;
19pub use biscotti::{
20 Expiration, Key, Processor, RemovalCookie, RequestCookie, RequestCookies, ResponseCookie,
21 ResponseCookieId, SameSite, config, request,
22};
23pub mod errors;
24pub mod response;
25
26mod components;
27pub use components::{INJECT_RESPONSE_COOKIES, extract_request_cookies, inject_response_cookies};
28
29mod response_cookies;
30pub use response_cookies::ResponseCookies;
31
32#[crate::singleton(pavex = crate)]
33#[doc(hidden)]
34// TODO: Remove once we have Pavex's annotations directly in `biscotti`,
35// behind a `pavex` feature flag.
36pub fn config_into_processor(config: ProcessorConfig) -> Processor {
37 config.into()
38}