Adding comment on awc dep.

fix/image_uploads_1
Dessalines 2021-08-25 10:34:26 -04:00
parent db52f6b7c7
commit a6987be62f
3 changed files with 3 additions and 5 deletions

1
Cargo.lock generated
View File

@ -1885,7 +1885,6 @@ dependencies = [
"log",
"rss",
"serde",
"serde_json",
"sha2",
"strum",
"url",

View File

@ -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"

View File

@ -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::<Images>().await.map_err(error::ErrorBadRequest)?;
Ok(HttpResponse::build(res.status()).json(images))
}