mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-28 01:07:09 +00:00
Merge pull request #2435 from zed-industries/use-json-post-request-for-update-requests
Use json_post() request for update requests
This commit is contained in:
commit
f576586cd7
3 changed files with 10 additions and 4 deletions
|
@ -273,7 +273,7 @@ impl AutoUpdater {
|
||||||
telemetry,
|
telemetry,
|
||||||
})?);
|
})?);
|
||||||
|
|
||||||
let mut response = client.get(&release.url, request_body, true).await?;
|
let mut response = client.post_json(&release.url, request_body, true).await?;
|
||||||
smol::io::copy(response.body_mut(), &mut dmg_file).await?;
|
smol::io::copy(response.body_mut(), &mut dmg_file).await?;
|
||||||
log::info!("downloaded update. path:{:?}", dmg_path);
|
log::info!("downloaded update. path:{:?}", dmg_path);
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ impl Telemetry {
|
||||||
}])?;
|
}])?;
|
||||||
|
|
||||||
this.http_client
|
this.http_client
|
||||||
.post_json(MIXPANEL_ENGAGE_URL, json_bytes.into())
|
.post_json(MIXPANEL_ENGAGE_URL, json_bytes.into(), false)
|
||||||
.await?;
|
.await?;
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ impl Telemetry {
|
||||||
json_bytes.clear();
|
json_bytes.clear();
|
||||||
serde_json::to_writer(&mut json_bytes, &events)?;
|
serde_json::to_writer(&mut json_bytes, &events)?;
|
||||||
this.http_client
|
this.http_client
|
||||||
.post_json(MIXPANEL_EVENTS_URL, json_bytes.into())
|
.post_json(MIXPANEL_EVENTS_URL, json_bytes.into(), false)
|
||||||
.await?;
|
.await?;
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ impl Telemetry {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.http_client
|
this.http_client
|
||||||
.post_json(CLICKHOUSE_EVENTS_URL.as_str(), json_bytes.into())
|
.post_json(CLICKHOUSE_EVENTS_URL.as_str(), json_bytes.into(), false)
|
||||||
.await?;
|
.await?;
|
||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,14 @@ pub trait HttpClient: Send + Sync {
|
||||||
&'a self,
|
&'a self,
|
||||||
uri: &str,
|
uri: &str,
|
||||||
body: AsyncBody,
|
body: AsyncBody,
|
||||||
|
follow_redirects: bool,
|
||||||
) -> BoxFuture<'a, Result<Response<AsyncBody>, Error>> {
|
) -> BoxFuture<'a, Result<Response<AsyncBody>, Error>> {
|
||||||
let request = isahc::Request::builder()
|
let request = isahc::Request::builder()
|
||||||
|
.redirect_policy(if follow_redirects {
|
||||||
|
RedirectPolicy::Follow
|
||||||
|
} else {
|
||||||
|
RedirectPolicy::None
|
||||||
|
})
|
||||||
.method(Method::POST)
|
.method(Method::POST)
|
||||||
.uri(uri)
|
.uri(uri)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
|
|
Loading…
Reference in a new issue