1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-01-22 23:05:56 +01:00

Merge pull request #23 from JohnTitor/new-session

Release actix-session v0.4.0-alpha.1
This commit is contained in:
Yuki Okushi 2020-03-15 07:14:13 +09:00 committed by GitHub
commit d913550570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 36 deletions

View File

@ -1,10 +1,11 @@
# Changes
## [0.4.0-alpha.1] - 2020-03-12
## [0.4.0-alpha.1] - 2020-03-14
* Update the `time` dependency to 0.2.7
* Update the `actix-web` dependency to 3.0.0-alpha.1
* Long lasting auto-prolonged session [#1292]
* Minimize `futures` dependency
[#1292]: https://github.com/actix/actix-web/pull/1292

View File

@ -1,6 +1,6 @@
[package]
name = "actix-session"
version = "0.3.0"
version = "0.4.0-alpha.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Session for actix-web framework."
readme = "README.md"
@ -26,7 +26,7 @@ actix-web = "3.0.0-alpha.1"
actix-service = "1.0.1"
bytes = "0.5.3"
derive_more = "0.99.2"
futures = "0.3.1"
futures-util = { version = "0.3.4", default-features = false }
serde = "1.0"
serde_json = "1.0"
time = { version = "0.2.7", default-features = false, features = ["std"] }

View File

@ -25,7 +25,7 @@ use actix_web::dev::{ServiceRequest, ServiceResponse};
use actix_web::http::{header::SET_COOKIE, HeaderValue};
use actix_web::{Error, HttpMessage, ResponseError};
use derive_more::{Display, From};
use futures::future::{ok, FutureExt, LocalBoxFuture, Ready};
use futures_util::future::{ok, FutureExt, LocalBoxFuture, Ready};
use serde_json::error::Error as JsonError;
use time::{Duration, OffsetDateTime};
@ -391,11 +391,9 @@ mod tests {
let mut app = test::init_service(
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false))
.service(web::resource("/").to(|ses: Session| {
async move {
let _ = ses.set("counter", 100);
"test"
}
.service(web::resource("/").to(|ses: Session| async move {
let _ = ses.set("counter", 100);
"test"
})),
)
.await;
@ -414,11 +412,9 @@ mod tests {
let mut app = test::init_service(
App::new()
.wrap(CookieSession::private(&[0; 32]).secure(false))
.service(web::resource("/").to(|ses: Session| {
async move {
let _ = ses.set("counter", 100);
"test"
}
.service(web::resource("/").to(|ses: Session| async move {
let _ = ses.set("counter", 100);
"test"
})),
)
.await;
@ -437,11 +433,9 @@ mod tests {
let mut app = test::init_service(
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false))
.service(web::resource("/").to(|ses: Session| {
async move {
let _ = ses.set("counter", 100);
"test"
}
.service(web::resource("/").to(|ses: Session| async move {
let _ = ses.set("counter", 100);
"test"
})),
)
.await;
@ -468,17 +462,13 @@ mod tests {
.same_site(SameSite::Lax)
.max_age(100),
)
.service(web::resource("/").to(|ses: Session| {
async move {
let _ = ses.set("counter", 100);
"test"
}
.service(web::resource("/").to(|ses: Session| async move {
let _ = ses.set("counter", 100);
"test"
}))
.service(web::resource("/test/").to(|ses: Session| {
async move {
let val: usize = ses.get("counter").unwrap().unwrap();
format!("counter: {}", val)
}
.service(web::resource("/test/").to(|ses: Session| async move {
let val: usize = ses.get("counter").unwrap().unwrap();
format!("counter: {}", val)
})),
)
.await;
@ -505,11 +495,9 @@ mod tests {
let mut app = test::init_service(
App::new()
.wrap(CookieSession::signed(&[0; 32]).secure(false).expires_in(60))
.service(web::resource("/").to(|ses: Session| {
async move {
let _ = ses.set("counter", 100);
"test"
}
.service(web::resource("/").to(|ses: Session| async move {
let _ = ses.set("counter", 100);
"test"
}))
.service(
web::resource("/test/")

View File

@ -49,10 +49,9 @@ use actix_web::dev::{
Extensions, Payload, RequestHead, ServiceRequest, ServiceResponse,
};
use actix_web::{Error, FromRequest, HttpMessage, HttpRequest};
use futures::future::{ok, Ready};
use futures_util::future::{ok, Ready};
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde_json;
#[cfg(feature = "cookie-session")]
mod cookie;