Update actix-web.

This commit is contained in:
Luca Palmieri 2021-12-26 16:15:49 +01:00
parent fe52f5f9f6
commit 3f1bc9bb79
4 changed files with 246 additions and 339 deletions

571
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,8 +13,8 @@ path = "src/main.rs"
name = "zero2prod"
[dependencies]
actix-web = "=4.0.0-beta.9"
actix-http = "=3.0.0-beta.10"
actix-web = "=4.0.0-beta.15"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
serde = "1.0.115"
config = { version = "0.10.1", default-features = false, features = ["yaml"] }
sqlx = { version = "0.5.5", default-features = false, features = ["runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate"] }
@ -22,6 +22,4 @@ uuid = { version = "0.8.1", features = ["v4"] }
chrono = "0.4.15"
[dev-dependencies]
actix-rt = "2"
reqwest = { version = "0.11", features = ["json"] }
tokio = "1"

View file

@ -3,7 +3,7 @@ use std::net::TcpListener;
use zero2prod::configuration::get_configuration;
use zero2prod::startup::run;
#[actix_web::main]
#[tokio::main]
async fn main() -> std::io::Result<()> {
let configuration = get_configuration().expect("Failed to read configuration.");
let connection_pool = PgPool::connect(&configuration.database.connection_string())

View file

@ -49,7 +49,7 @@ pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
connection_pool
}
#[actix_rt::test]
#[tokio::test]
async fn health_check_works() {
// Arrange
let app = spawn_app().await;
@ -68,7 +68,7 @@ async fn health_check_works() {
assert_eq!(Some(0), response.content_length());
}
#[actix_rt::test]
#[tokio::test]
async fn subscribe_returns_a_200_for_valid_form_data() {
// Arrange
let app = spawn_app().await;
@ -96,7 +96,7 @@ async fn subscribe_returns_a_200_for_valid_form_data() {
assert_eq!(saved.name, "le guin");
}
#[actix_rt::test]
#[tokio::test]
async fn subscribe_returns_a_400_when_data_is_missing() {
// Arrange
let app = spawn_app().await;