diff --git a/src/jobs/instance.rs b/src/jobs/instance.rs index 25a5491..5f7c3a2 100644 --- a/src/jobs/instance.rs +++ b/src/jobs/instance.rs @@ -41,7 +41,7 @@ impl QueryInstance { .await?; let description = if instance.description.is_empty() { - instance.short_description + instance.short_description.unwrap_or(String::new()) } else { instance.description }; @@ -102,7 +102,7 @@ impl ActixJob for QueryInstance { #[derive(serde::Deserialize)] struct Instance { title: String, - short_description: String, + short_description: Option, description: String, version: String, registrations: bool, diff --git a/src/requests.rs b/src/requests.rs index 24eabd3..86a2e3c 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -110,9 +110,12 @@ impl Requests { return Err(MyError::Status(res.status())); } - res.json() + let body = res + .body() .await - .map_err(|e| MyError::ReceiveResponse(url.to_string(), e.to_string())) + .map_err(|e| MyError::ReceiveResponse(url.to_string(), e.to_string()))?; + + Ok(serde_json::from_slice(body.as_ref())?) } pub async fn fetch_bytes(&self, url: &str) -> Result<(String, Bytes), MyError> {