Add 'LocalRequest' cookies as original.

This commit is contained in:
Sergio Benitez 2017-07-04 14:51:00 -07:00
parent 6df5564983
commit 58445be4ff
2 changed files with 8 additions and 1 deletions

View File

@ -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`.
///

View File

@ -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
}