#[non_exhaustive]pub struct CookieKit {
pub request_cookies: Option<Constructor>,
pub response_cookies: Option<Constructor>,
pub processor: Option<Constructor>,
pub processor_config: Option<Constructor>,
pub response_cookie_injector: Option<PostProcessingMiddleware>,
}
Expand description
A collection of components required to work with request and response cookies.
§Guide
Check out the cookie installation section of Pavex’s guide for a thorough introduction to cookies and how to customize them.
§Example
use pavex::blueprint::Blueprint;
use pavex::cookie::CookieKit;
let mut bp = Blueprint::new();
let kit = CookieKit::new().register(&mut bp);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.The constructor for RequestCookies
.
By default, it uses extract_request_cookies
.
The error is handled by ExtractRequestCookiesError::into_response
.
The constructor for ResponseCookies
.
By default, it uses ResponseCookies::new
.
processor: Option<Constructor>
The constructor for Processor
.
By default, it uses Processor::from
processor_config: Option<Constructor>
The constructor for ProcessorConfig
.
By default, it’s None
.
You can use with_default_processor_config
to set it ProcessorConfig::default
.
A post-processing middleware to inject response cookies into the outgoing response
via the Set-Cookie
header.
By default, it’s set to inject_response_cookies
.
The error is handled by InjectResponseCookiesError::into_response
.
Implementations§
Source§impl CookieKit
impl CookieKit
Sourcepub fn with_default_processor_config(self) -> Self
pub fn with_default_processor_config(self) -> Self
Set the ProcessorConfig
constructor to ProcessorConfig::default
.