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:
parent
5a8df0b1e8
commit
db1dbb7a48
1 changed files with 4 additions and 4 deletions
|
@ -174,7 +174,7 @@ impl ApiClient {
|
||||||
let endpoint = self.endpoint.join("_api/v1/upload-path")?;
|
let endpoint = self.endpoint.join("_api/v1/upload-path")?;
|
||||||
let upload_info_json = serde_json::to_string(&nar_info)?;
|
let upload_info_json = serde_json::to_string(&nar_info)?;
|
||||||
|
|
||||||
let res = self
|
let req = self
|
||||||
.client
|
.client
|
||||||
.put(endpoint)
|
.put(endpoint)
|
||||||
.header(
|
.header(
|
||||||
|
@ -182,9 +182,9 @@ impl ApiClient {
|
||||||
HeaderValue::from_str(&upload_info_json)?,
|
HeaderValue::from_str(&upload_info_json)?,
|
||||||
)
|
)
|
||||||
.header(USER_AGENT, HeaderValue::from_str(ATTIC_USER_AGENT)?)
|
.header(USER_AGENT, HeaderValue::from_str(ATTIC_USER_AGENT)?)
|
||||||
.body(Body::wrap_stream(stream))
|
.body(Body::wrap_stream(stream));
|
||||||
.send()
|
|
||||||
.await?;
|
let res = req.send().await?;
|
||||||
|
|
||||||
if res.status().is_success() {
|
if res.status().is_success() {
|
||||||
match res.json().await {
|
match res.json().await {
|
||||||
|
|
Loading…
Reference in a new issue