1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

updated cookie session to update on change

This commit is contained in:
dowwie 2019-06-29 14:24:02 -04:00
parent 50a9d9e2c5
commit 0e05b37082

View File

@ -28,7 +28,7 @@ use futures::future::{ok, Future, FutureResult};
use futures::Poll;
use serde_json::error::Error as JsonError;
use crate::Session;
use crate::{Session, SessionStatus};
/// Errors that can occur during handling cookie session
#[derive(Debug, From, Display)]
@ -308,10 +308,10 @@ where
Session::set_session(state.into_iter(), &mut req);
Box::new(self.service.call(req).map(move |mut res| {
if let (_status, Some(state)) = Session::get_changes(&mut res) {
res.checked_expr(|res| inner.set_cookie(res, state))
} else {
res
match Session::get_changes(&mut res) {
(SessionStatus::Changed, Some(state)) =>
res.checked_expr(|res| inner.set_cookie(res, state)),
_ => res
}
}))
}