forked from StrafesNET/asset-tool
rbx_asset v0.2.2 error on http status
This commit is contained in:
parent
abea7dd712
commit
b14915a63a
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1166,7 +1166,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rbx_asset"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"flate2",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rbx_asset"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
edition = "2021"
|
||||
publish = ["strafesnet"]
|
||||
|
||||
|
@ -234,9 +234,9 @@ impl CookieContext{
|
||||
}
|
||||
}
|
||||
|
||||
let resp=self.post(url,body).await.map_err(CreateError::PostError)?;
|
||||
|
||||
Ok(resp.json::<UploadResponse>().await.map_err(CreateError::Reqwest)?)
|
||||
Ok(self.post(url,body).await.map_err(CreateError::PostError)?
|
||||
.error_for_status().map_err(CreateError::Reqwest)?
|
||||
.json::<UploadResponse>().await.map_err(CreateError::Reqwest)?)
|
||||
}
|
||||
pub async fn upload(&self,config:UploadRequest,body:impl Into<reqwest::Body>+Clone)->Result<UploadResponse,UploadError>{
|
||||
let mut url=reqwest::Url::parse("https://data.roblox.com/Data/Upload.ashx?json=1&type=Model&genreTypeId=1").map_err(UploadError::ParseError)?;
|
||||
@ -265,9 +265,9 @@ impl CookieContext{
|
||||
}
|
||||
}
|
||||
|
||||
let resp=self.post(url,body).await.map_err(UploadError::PostError)?;
|
||||
|
||||
Ok(resp.json::<UploadResponse>().await.map_err(UploadError::Reqwest)?)
|
||||
Ok(self.post(url,body).await.map_err(UploadError::PostError)?
|
||||
.error_for_status().map_err(UploadError::Reqwest)?
|
||||
.json::<UploadResponse>().await.map_err(UploadError::Reqwest)?)
|
||||
}
|
||||
pub async fn get_asset(&self,config:GetAssetRequest)->Result<Vec<u8>,GetError>{
|
||||
let mut url=reqwest::Url::parse("https://assetdelivery.roblox.com/v1/asset/").map_err(GetError::ParseError)?;
|
||||
@ -279,9 +279,9 @@ impl CookieContext{
|
||||
query.append_pair("version",version.to_string().as_str());
|
||||
}
|
||||
}
|
||||
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 +303,7 @@ impl CookieContext{
|
||||
}
|
||||
|
||||
Ok(self.get(url).await.map_err(AssetVersionsPageError::Reqwest)?
|
||||
.error_for_status().map_err(AssetVersionsPageError::Reqwest)?
|
||||
.json::<AssetVersionsPageResponse>().await.map_err(AssetVersionsPageError::Reqwest)?)
|
||||
}
|
||||
pub async fn get_inventory_page(&self,config:InventoryPageRequest)->Result<InventoryPageResponse,InventoryPageError>{
|
||||
@ -316,6 +317,7 @@ impl CookieContext{
|
||||
}
|
||||
|
||||
Ok(self.get(url).await.map_err(InventoryPageError::Reqwest)?
|
||||
.error_for_status().map_err(InventoryPageError::Reqwest)?
|
||||
.json::<InventoryPageResponse>().await.map_err(InventoryPageError::Reqwest)?)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user