mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-21 10:04:49 +01:00
update session impl
This commit is contained in:
parent
ae28b1ad81
commit
abb6c6ba0a
@ -12,7 +12,7 @@ use redis_async::resp::RespValue;
|
|||||||
use cookie::{CookieJar, Cookie, Key};
|
use cookie::{CookieJar, Cookie, Key};
|
||||||
use http::header::{self, HeaderValue};
|
use http::header::{self, HeaderValue};
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
use actix_web::{error, Error, HttpRequest, HttpResponse};
|
use actix_web::{error, Error, Result, HttpRequest, HttpResponse};
|
||||||
use actix_web::middleware::{SessionImpl, SessionBackend, Response as MiddlewareResponse};
|
use actix_web::middleware::{SessionImpl, SessionBackend, Response as MiddlewareResponse};
|
||||||
|
|
||||||
use redis::{Command, RedisActor};
|
use redis::{Command, RedisActor};
|
||||||
@ -51,11 +51,12 @@ impl SessionImpl for RedisSession {
|
|||||||
self.state.clear()
|
self.state.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&self, resp: HttpResponse) -> MiddlewareResponse {
|
fn write(&self, resp: HttpResponse) -> Result<MiddlewareResponse> {
|
||||||
if self.changed {
|
if self.changed {
|
||||||
MiddlewareResponse::Future(self.inner.update(&self.state, resp, self.value.as_ref()))
|
Ok(MiddlewareResponse::Future(
|
||||||
|
self.inner.update(&self.state, resp, self.value.as_ref())))
|
||||||
} else {
|
} else {
|
||||||
MiddlewareResponse::Done(resp)
|
Ok(MiddlewareResponse::Done(resp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user