Do not use post_json() to auto update

This commit is contained in:
Joseph Lyons 2023-05-04 12:12:01 -04:00
parent f51425d390
commit 8313414e1e
3 changed files with 4 additions and 10 deletions

View File

@ -273,7 +273,7 @@ impl AutoUpdater {
telemetry,
})?);
let mut response = client.post_json(&release.url, request_body, true).await?;
let mut response = client.get(&release.url, request_body, true).await?;
smol::io::copy(response.body_mut(), &mut dmg_file).await?;
log::info!("downloaded update. path:{:?}", dmg_path);

View File

@ -270,7 +270,7 @@ impl Telemetry {
}])?;
this.http_client
.post_json(MIXPANEL_ENGAGE_URL, json_bytes.into(), false)
.post_json(MIXPANEL_ENGAGE_URL, json_bytes.into())
.await?;
anyhow::Ok(())
}
@ -404,7 +404,7 @@ impl Telemetry {
json_bytes.clear();
serde_json::to_writer(&mut json_bytes, &events)?;
this.http_client
.post_json(MIXPANEL_EVENTS_URL, json_bytes.into(), false)
.post_json(MIXPANEL_EVENTS_URL, json_bytes.into())
.await?;
anyhow::Ok(())
}
@ -454,7 +454,7 @@ impl Telemetry {
}
this.http_client
.post_json(CLICKHOUSE_EVENTS_URL.as_str(), json_bytes.into(), false)
.post_json(CLICKHOUSE_EVENTS_URL.as_str(), json_bytes.into())
.await?;
anyhow::Ok(())
}

View File

@ -40,14 +40,8 @@ pub trait HttpClient: Send + Sync {
&'a self,
uri: &str,
body: AsyncBody,
follow_redirects: bool,
) -> BoxFuture<'a, Result<Response<AsyncBody>, Error>> {
let request = isahc::Request::builder()
.redirect_policy(if follow_redirects {
RedirectPolicy::Follow
} else {
RedirectPolicy::None
})
.method(Method::POST)
.uri(uri)
.header("Content-Type", "application/json")