1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 18:09:22 +02:00

refactor handler rtype handling

This commit is contained in:
Nikolay Kim
2017-11-29 09:17:00 -08:00
parent e9bfab8012
commit 6177d86d97
6 changed files with 34 additions and 44 deletions

View File

@ -218,7 +218,6 @@ struct CookieSessionInner {
path: String,
domain: Option<String>,
secure: bool,
http_only: bool,
}
impl CookieSessionInner {
@ -229,8 +228,7 @@ impl CookieSessionInner {
name: "actix_session".to_owned(),
path: "/".to_owned(),
domain: None,
secure: true,
http_only: true }
secure: true }
}
fn set_cookie(&self, resp: &mut HttpResponse, state: &HashMap<String, String>) -> Result<()> {
@ -243,7 +241,7 @@ impl CookieSessionInner {
let mut cookie = Cookie::new(self.name.clone(), value);
cookie.set_path(self.path.clone());
cookie.set_secure(self.secure);
cookie.set_http_only(self.http_only);
cookie.set_http_only(true);
if let Some(ref domain) = self.domain {
cookie.set_domain(domain.clone());
@ -354,7 +352,6 @@ impl SessionBackend for CookieSessionBackend {
/// .domain("www.rust-lang.org")
/// .path("/")
/// .secure(true)
/// .http_only(true)
/// .finish();
/// # }
/// ```
@ -384,12 +381,6 @@ impl CookieSessionBackendBuilder {
self
}
/// Sets the `http_only` field in the session cookie being built.
pub fn http_only(mut self, value: bool) -> CookieSessionBackendBuilder {
self.0.http_only = value;
self
}
/// Finishes building and returns the built `CookieSessionBackend`.
pub fn finish(self) -> CookieSessionBackend {
CookieSessionBackend(Rc::new(self.0))