diff --git a/actix-session/CHANGES.md b/actix-session/CHANGES.md index 0c9dca564..b4ef66c35 100644 --- a/actix-session/CHANGES.md +++ b/actix-session/CHANGES.md @@ -1,5 +1,10 @@ # Changes + +## [0.3.0-alpha.4] - 2019-12-xx + +* Allow access to sessions also from not mutable references to the request + ## [0.3.0-alpha.3] - 2019-12-xx * Add access to the session from RequestHead for use of session from guard methods diff --git a/actix-session/src/lib.rs b/actix-session/src/lib.rs index ef44e5213..ac60901c3 100644 --- a/actix-session/src/lib.rs +++ b/actix-session/src/lib.rs @@ -85,23 +85,23 @@ pub struct Session(Rc>); /// Helper trait that allows to get session pub trait UserSession { - fn get_session(&mut self) -> Session; + fn get_session(&self) -> Session; } impl UserSession for HttpRequest { - fn get_session(&mut self) -> Session { + fn get_session(&self) -> Session { Session::get_session(&mut *self.extensions_mut()) } } impl UserSession for ServiceRequest { - fn get_session(&mut self) -> Session { + fn get_session(&self) -> Session { Session::get_session(&mut *self.extensions_mut()) } } impl UserSession for RequestHead { - fn get_session(&mut self) -> Session { + fn get_session(&self) -> Session { Session::get_session(&mut *self.extensions_mut()) } }