switch back to ureq from nyquest for http client
note: even if this raises binary size by a significant amount, it should in theory be more reliable, so it is a worthy sacrifice.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use nyquest::{ClientBuilder, blocking::Request};
|
||||
use semver::Version;
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -33,11 +32,9 @@ struct Asset {
|
||||
|
||||
pub fn get_latest_release() -> Result<Release, Box<dyn std::error::Error>> {
|
||||
let request_url = format!("{CODEBERG_ENDPOINT_ROOT}/repos/futile/gta-tools/releases/latest");
|
||||
let client = ClientBuilder::default()
|
||||
.user_agent(APP_USER_AGENT)
|
||||
.build_blocking()?;
|
||||
let response = client.request(Request::get(request_url))?;
|
||||
let json = response.json::<LatestRelease>()?;
|
||||
let mut response = ureq::get(request_url).header("User-Agent", APP_USER_AGENT).call()?;
|
||||
let body = response.body_mut();
|
||||
let json = body.read_json::<LatestRelease>()?;
|
||||
let tag_name = json.tag_name;
|
||||
let browser_download_url = &json.assets[0].browser_download_url;
|
||||
Ok(Release {
|
||||
|
||||
Reference in New Issue
Block a user