Don't validate content type on response, pleromo is weird

This commit is contained in:
asonix 2020-07-10 17:47:41 -05:00
parent c499b5355c
commit c4b4f13fa6
2 changed files with 7 additions and 4 deletions

View file

@ -41,7 +41,7 @@ impl QueryInstance {
.await?; .await?;
let description = if instance.description.is_empty() { let description = if instance.description.is_empty() {
instance.short_description instance.short_description.unwrap_or(String::new())
} else { } else {
instance.description instance.description
}; };
@ -102,7 +102,7 @@ impl ActixJob for QueryInstance {
#[derive(serde::Deserialize)] #[derive(serde::Deserialize)]
struct Instance { struct Instance {
title: String, title: String,
short_description: String, short_description: Option<String>,
description: String, description: String,
version: String, version: String,
registrations: bool, registrations: bool,

View file

@ -110,9 +110,12 @@ impl Requests {
return Err(MyError::Status(res.status())); return Err(MyError::Status(res.status()));
} }
res.json() let body = res
.body()
.await .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> { pub async fn fetch_bytes(&self, url: &str) -> Result<(String, Bytes), MyError> {