1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

client/api: Refactor

This commit is contained in:
Zhaofeng Li 2023-01-14 23:55:10 -07:00
parent 5a8df0b1e8
commit db1dbb7a48

View file

@ -174,7 +174,7 @@ impl ApiClient {
let endpoint = self.endpoint.join("_api/v1/upload-path")?;
let upload_info_json = serde_json::to_string(&nar_info)?;
let res = self
let req = self
.client
.put(endpoint)
.header(
@ -182,9 +182,9 @@ impl ApiClient {
HeaderValue::from_str(&upload_info_json)?,
)
.header(USER_AGENT, HeaderValue::from_str(ATTIC_USER_AGENT)?)
.body(Body::wrap_stream(stream))
.send()
.await?;
.body(Body::wrap_stream(stream));
let res = req.send().await?;
if res.status().is_success() {
match res.json().await {