mirror of https://github.com/rwf2/Rocket.git
Add 'LocalRequest' cookies as original.
This commit is contained in:
parent
6df5564983
commit
58445be4ff
|
@ -132,6 +132,13 @@ impl<'a> Cookies<'a> {
|
|||
Cookie::parse_encoded(cookie_str).map(|c| c.into_owned()).ok()
|
||||
}
|
||||
|
||||
/// Adds an original `cookie` to this collection.
|
||||
pub(crate) fn add_original(&mut self, cookie: Cookie<'static>) {
|
||||
if let Cookies::Jarred(ref mut jar, _) = *self {
|
||||
jar.add_original(cookie)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a reference to the `Cookie` inside this container with the name
|
||||
/// `name`. If no such cookie exists, returns `None`.
|
||||
///
|
||||
|
|
|
@ -185,7 +185,7 @@ impl<'c> LocalRequest<'c> {
|
|||
/// ```
|
||||
#[inline]
|
||||
pub fn cookie(self, cookie: Cookie<'static>) -> Self {
|
||||
self.request.cookies().add(cookie);
|
||||
self.request.cookies().add_original(cookie);
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue