Skip to content

Commit d461441

Browse files
authored
Merge pull request #28 from SakaDream/update-dependencies
Update dependencies
2 parents 5454521 + 28ed7db commit d461441

File tree

4 files changed

+30
-40
lines changed

4 files changed

+30
-40
lines changed

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@ authors = ["SakaDream <bahaimt@gmail.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
actix-web = "3.0.0"
8+
actix-web = "3.3.2"
99
actix-rt = "1.1.1"
1010
actix-service = "1.0.6"
11-
actix-cors = "0.3.0"
11+
actix-cors = "0.5.3"
1212
log = "0.4.11"
13-
env_logger = "0.7.1"
13+
env_logger = "0.8.2"
1414
diesel_migrations = "1.4.0"
15-
serde = "1.0.116"
16-
serde_derive = "1.0.116"
17-
serde_json = "1.0.57"
15+
serde = "1.0.118"
16+
serde_derive = "1.0.118"
17+
serde_json = "1.0.60"
1818
dotenv = "0.15.0"
19-
futures = "0.3.5"
19+
futures = "0.3.8"
2020
failure = "0.1.8"
21-
derive_more = "0.99.10"
21+
derive_more = "0.99.11"
2222
jsonwebtoken = "7.2.0"
23-
bcrypt = "0.8.2"
23+
bcrypt = "0.9.0"
2424

2525
[dependencies.diesel]
2626
version = "1.4.5"
2727
features = ["postgres", "r2d2", "chrono"]
2828

2929
[dependencies.chrono]
30-
version = "0.4.15"
30+
version = "0.4.19"
3131
features = ["serde"]
3232

3333
[dependencies.uuid]

src/api/account_controller.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ mod tests {
4848
async fn test_signup_ok() {
4949
let mut app = test::init_service(
5050
App::new()
51-
.wrap(Cors::new()
51+
.wrap(Cors::default()
5252
.send_wildcard()
5353
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
5454
.allowed_header(http::header::CONTENT_TYPE)
55-
.max_age(3600)
56-
.finish())
55+
.max_age(3600))
5756
.data(config::db::migrate_and_config_db(":memory:"))
5857
.wrap(actix_web::middleware::Logger::default())
5958
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -80,12 +79,11 @@ mod tests {
8079
async fn test_signup_duplicate_user() {
8180
let mut app = test::init_service(
8281
App::new()
83-
.wrap(Cors::new()
82+
.wrap(Cors::default()
8483
.send_wildcard()
8584
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
8685
.allowed_header(http::header::CONTENT_TYPE)
87-
.max_age(3600)
88-
.finish())
86+
.max_age(3600))
8987
.data(config::db::migrate_and_config_db(":memory:"))
9088
.wrap(actix_web::middleware::Logger::default())
9189
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -119,12 +117,11 @@ mod tests {
119117
async fn test_login_ok_with_username() {
120118
let mut app = test::init_service(
121119
App::new()
122-
.wrap(Cors::new()
120+
.wrap(Cors::default()
123121
.send_wildcard()
124122
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
125123
.allowed_header(http::header::CONTENT_TYPE)
126-
.max_age(3600)
127-
.finish())
124+
.max_age(3600))
128125
.data(config::db::migrate_and_config_db(":memory:"))
129126
.wrap(actix_web::middleware::Logger::default())
130127
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -155,12 +152,11 @@ mod tests {
155152
async fn test_login_ok_with_email() {
156153
let mut app = test::init_service(
157154
App::new()
158-
.wrap(Cors::new()
155+
.wrap(Cors::default()
159156
.send_wildcard()
160157
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
161158
.allowed_header(http::header::CONTENT_TYPE)
162-
.max_age(3600)
163-
.finish())
159+
.max_age(3600))
164160
.data(config::db::migrate_and_config_db(":memory:"))
165161
.wrap(actix_web::middleware::Logger::default())
166162
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -191,12 +187,11 @@ mod tests {
191187
async fn test_login_password_incorrect_with_username() {
192188
let mut app = test::init_service(
193189
App::new()
194-
.wrap(Cors::new()
190+
.wrap(Cors::default()
195191
.send_wildcard()
196192
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
197193
.allowed_header(http::header::CONTENT_TYPE)
198-
.max_age(3600)
199-
.finish())
194+
.max_age(3600))
200195
.data(config::db::migrate_and_config_db(":memory:"))
201196
.wrap(actix_web::middleware::Logger::default())
202197
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -227,12 +222,11 @@ mod tests {
227222
async fn test_login_password_incorrect_with_email() {
228223
let mut app = test::init_service(
229224
App::new()
230-
.wrap(Cors::new()
225+
.wrap(Cors::default()
231226
.send_wildcard()
232227
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
233228
.allowed_header(http::header::CONTENT_TYPE)
234-
.max_age(3600)
235-
.finish())
229+
.max_age(3600))
236230
.data(config::db::migrate_and_config_db(":memory:"))
237231
.wrap(actix_web::middleware::Logger::default())
238232
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -263,12 +257,11 @@ mod tests {
263257
async fn test_login_user_not_found_with_username() {
264258
let mut app = test::init_service(
265259
App::new()
266-
.wrap(Cors::new()
260+
.wrap(Cors::default()
267261
.send_wildcard()
268262
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
269263
.allowed_header(http::header::CONTENT_TYPE)
270-
.max_age(3600)
271-
.finish())
264+
.max_age(3600))
272265
.data(config::db::migrate_and_config_db(":memory:"))
273266
.wrap(actix_web::middleware::Logger::default())
274267
.wrap(crate::middleware::authen_middleware::Authentication)
@@ -299,12 +292,11 @@ mod tests {
299292
async fn test_login_user_not_found_with_email() {
300293
let mut app = test::init_service(
301294
App::new()
302-
.wrap(Cors::new()
295+
.wrap(Cors::default()
303296
.send_wildcard()
304297
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
305298
.allowed_header(http::header::CONTENT_TYPE)
306-
.max_age(3600)
307-
.finish())
299+
.max_age(3600))
308300
.data(config::db::migrate_and_config_db(":memory:"))
309301
.wrap(actix_web::middleware::Logger::default())
310302
.wrap(crate::middleware::authen_middleware::Authentication)

src/api/ping_controller.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ mod tests {
1818
async fn test_ping_ok() {
1919
let mut app = test::init_service(
2020
App::new()
21-
.wrap(Cors::new()
21+
.wrap(Cors::default()
2222
.send_wildcard()
2323
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
2424
.allowed_header(http::header::CONTENT_TYPE)
25-
.max_age(3600)
26-
.finish())
25+
.max_age(3600))
2726
.data(config::db::migrate_and_config_db(":memory:"))
2827
.wrap(actix_web::middleware::Logger::default())
2928
.wrap(crate::middleware::authen_middleware::Authentication)

src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ async fn main() -> io::Result<()> {
5454

5555
HttpServer::new(move || {
5656
App::new()
57-
.wrap(Cors::new() // allowed_origin return access-control-allow-origin: * by default
57+
.wrap(Cors::default() // allowed_origin return access-control-allow-origin: * by default
5858
// .allowed_origin("http://127.0.0.1:8080")
5959
.send_wildcard()
6060
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE"])
6161
.allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT])
6262
.allowed_header(http::header::CONTENT_TYPE)
63-
.max_age(3600)
64-
.finish())
63+
.max_age(3600))
6564
.data(config::db::migrate_and_config_db(&db_url))
6665
.wrap(actix_web::middleware::Logger::default())
6766
.wrap(crate::middleware::authen_middleware::Authentication)

0 commit comments

Comments
 (0)