forked from StrafesNET/asset-tool
error for status for all
This commit is contained in:
parent
44d8670738
commit
2d2ebcece0
@ -290,7 +290,9 @@ impl CloudContext{
|
|||||||
}
|
}
|
||||||
let resp=self.get(url).await.map_err(GetError::Reqwest)?;
|
let resp=self.get(url).await.map_err(GetError::Reqwest)?;
|
||||||
|
|
||||||
let body=resp.bytes().await.map_err(GetError::Reqwest)?;
|
let body=self.get(url).await.map_err(GetError::Reqwest)?
|
||||||
|
.error_for_status().map_err(GetError::Reqwest)?
|
||||||
|
.bytes().await.map_err(GetError::Reqwest)?;
|
||||||
|
|
||||||
match maybe_gzip_decode(&mut std::io::Cursor::new(body)){
|
match maybe_gzip_decode(&mut std::io::Cursor::new(body)){
|
||||||
Ok(ReaderType::GZip(readable))=>read_readable(readable),
|
Ok(ReaderType::GZip(readable))=>read_readable(readable),
|
||||||
@ -303,6 +305,7 @@ impl CloudContext{
|
|||||||
let url=reqwest::Url::parse(raw_url.as_str()).map_err(AssetVersionsError::ParseError)?;
|
let url=reqwest::Url::parse(raw_url.as_str()).map_err(AssetVersionsError::ParseError)?;
|
||||||
|
|
||||||
Ok(self.get(url).await.map_err(AssetVersionsError::Reqwest)?
|
Ok(self.get(url).await.map_err(AssetVersionsError::Reqwest)?
|
||||||
|
.error_for_status().map_err(AssetVersionsError::Reqwest)?
|
||||||
.json::<AssetVersionsResponse>().await.map_err(AssetVersionsError::Reqwest)?)
|
.json::<AssetVersionsResponse>().await.map_err(AssetVersionsError::Reqwest)?)
|
||||||
}
|
}
|
||||||
pub async fn inventory_page(&self,config:InventoryPageRequest)->Result<InventoryPageResponse,InventoryPageError>{
|
pub async fn inventory_page(&self,config:InventoryPageRequest)->Result<InventoryPageResponse,InventoryPageError>{
|
||||||
@ -316,6 +319,7 @@ impl CloudContext{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(self.get(url).await.map_err(InventoryPageError::Reqwest)?
|
Ok(self.get(url).await.map_err(InventoryPageError::Reqwest)?
|
||||||
|
.error_for_status().map_err(InventoryPageError::Reqwest)?
|
||||||
.json::<InventoryPageResponse>().await.map_err(InventoryPageError::Reqwest)?)
|
.json::<InventoryPageResponse>().await.map_err(InventoryPageError::Reqwest)?)
|
||||||
}
|
}
|
||||||
pub async fn update_place(&self,config:UpdatePlaceRequest,body:impl Into<reqwest::Body>+Clone)->Result<UpdatePlaceResponse,UpdateError>{
|
pub async fn update_place(&self,config:UpdatePlaceRequest,body:impl Into<reqwest::Body>+Clone)->Result<UpdatePlaceResponse,UpdateError>{
|
||||||
@ -327,9 +331,8 @@ impl CloudContext{
|
|||||||
query.append_pair("versionType","Published");
|
query.append_pair("versionType","Published");
|
||||||
}
|
}
|
||||||
|
|
||||||
let resp=self.post(url,body).await.map_err(UpdateError::Reqwest)?
|
Ok(self.post(url,body).await.map_err(UpdateError::Reqwest)?
|
||||||
.error_for_status().map_err(UpdateError::Reqwest)?;
|
.error_for_status().map_err(UpdateError::Reqwest)?
|
||||||
|
.json::<UpdatePlaceResponse>().await.map_err(UpdateError::Reqwest)?)
|
||||||
Ok(resp.json::<UpdatePlaceResponse>().await.map_err(UpdateError::Reqwest)?)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user