diff --git a/rbx_asset/src/cloud.rs b/rbx_asset/src/cloud.rs index 90ce74e..dc276c8 100644 --- a/rbx_asset/src/cloud.rs +++ b/rbx_asset/src/cloud.rs @@ -290,7 +290,9 @@ impl CloudContext{ } 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)){ 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)?; Ok(self.get(url).await.map_err(AssetVersionsError::Reqwest)? + .error_for_status().map_err(AssetVersionsError::Reqwest)? .json::().await.map_err(AssetVersionsError::Reqwest)?) } pub async fn inventory_page(&self,config:InventoryPageRequest)->Result{ @@ -316,6 +319,7 @@ impl CloudContext{ } Ok(self.get(url).await.map_err(InventoryPageError::Reqwest)? + .error_for_status().map_err(InventoryPageError::Reqwest)? .json::().await.map_err(InventoryPageError::Reqwest)?) } pub async fn update_place(&self,config:UpdatePlaceRequest,body:impl Into+Clone)->Result{ @@ -327,9 +331,8 @@ impl CloudContext{ query.append_pair("versionType","Published"); } - let resp=self.post(url,body).await.map_err(UpdateError::Reqwest)? - .error_for_status().map_err(UpdateError::Reqwest)?; - - Ok(resp.json::().await.map_err(UpdateError::Reqwest)?) + Ok(self.post(url,body).await.map_err(UpdateError::Reqwest)? + .error_for_status().map_err(UpdateError::Reqwest)? + .json::().await.map_err(UpdateError::Reqwest)?) } }