From a6987be62f906f2c9d0fc47bb28f7792518899b3 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 25 Aug 2021 10:34:26 -0400 Subject: [PATCH] Adding comment on awc dep. --- Cargo.lock | 1 - crates/routes/Cargo.toml | 3 ++- crates/routes/src/images.rs | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef6ee1397..2d79489f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1885,7 +1885,6 @@ dependencies = [ "log", "rss", "serde", - "serde_json", "sha2", "strum", "url", diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index e2f3188df..1ec729db9 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -27,7 +27,8 @@ anyhow = "1.0.43" chrono = { version = "0.4.19", features = ["serde"] } rss = "1.10.0" serde = { version = "1.0.127", features = ["derive"] } -serde_json = "1.0.66" +# TODO awc should use default-features = false, because gzip is a heavy dependency. +# This must wait for pictrs to have a configurable disabled gzip awc = "3.0.0-beta.7" url = { version = "2.2.2", features = ["serde"] } strum = "0.21.0" diff --git a/crates/routes/src/images.rs b/crates/routes/src/images.rs index 364c93f8e..a89bde0f1 100644 --- a/crates/routes/src/images.rs +++ b/crates/routes/src/images.rs @@ -66,9 +66,7 @@ async fn upload( .await .map_err(error::ErrorBadRequest)?; - // Note: res.json() is currently broken. - let body = res.body().await?; - let images: Images = serde_json::from_slice(&body)?; + let images = res.json::().await.map_err(error::ErrorBadRequest)?; Ok(HttpResponse::build(res.status()).json(images)) }