Installation
The cookie machinery is not included in the project scaffolded by pavex new.
You need to add a few lines to set it up:
use pavex::{Blueprint, blueprint::from, cookie::INJECT_RESPONSE_COOKIES};
pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
bp.import(from![
// Other imports [...]
pavex // (1)!
]);
bp.post_process(INJECT_RESPONSE_COOKIES); // (2)!
// [...]
}
- Bring
pavex's cookie components into scope (e.g.ResponseCookies). - Attach cookies to the outgoing response.
It's enough to add INJECT_RESPONSE_COOKIES to your middleware stack
if you're already importing components from the pavex crate.