[wip] impl Client for ureq::Agent
- clippy fix
This commit is contained in:
parent
dc2a330d58
commit
0993679641
4 changed files with 5 additions and 5 deletions
|
|
@ -55,7 +55,7 @@ impl FileState {
|
||||||
) -> sharry::Result<file::Uploading> {
|
) -> sharry::Result<file::Uploading> {
|
||||||
match self {
|
match self {
|
||||||
FileState::C(checked) => {
|
FileState::C(checked) => {
|
||||||
let endpoint = &uri.endpoint(format!("alias/upload/{}/files/tus", share_id));
|
let endpoint = &uri.endpoint(format!("alias/upload/{share_id}/files/tus"));
|
||||||
checked.start_upload(http, endpoint, alias_id)
|
checked.start_upload(http, endpoint, alias_id)
|
||||||
}
|
}
|
||||||
FileState::U(uploading) => Ok(uploading),
|
FileState::U(uploading) => Ok(uploading),
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl<'t> Chunk<'t> {
|
||||||
// BOOKMARK this might **panic** on platforms where `usize` has more than 64 bit.
|
// BOOKMARK this might **panic** on platforms where `usize` has more than 64 bit.
|
||||||
// Also, you've allocated more than 2 EiB ... in ONE chunk.
|
// Also, you've allocated more than 2 EiB ... in ONE chunk.
|
||||||
// Whoa! Maybe just chill?
|
// Whoa! Maybe just chill?
|
||||||
u64::try_from(len).unwrap_or_else(|e| panic!("usize={} did not fit into u64: {}", len, e))
|
u64::try_from(len).unwrap_or_else(|e| panic!("usize={len} did not fit into u64: {e}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_patch_uri(&self) -> &str {
|
pub fn get_patch_uri(&self) -> &str {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ impl Uri {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn endpoint(&self, endpoint: impl fmt::Display) -> String {
|
pub fn endpoint(&self, endpoint: impl fmt::Display) -> String {
|
||||||
let uri = format!("{}/{}", self, endpoint);
|
let uri = format!("{self}/{endpoint}");
|
||||||
debug!("endpoint: {uri:?}");
|
debug!("endpoint: {uri:?}");
|
||||||
|
|
||||||
uri
|
uri
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ impl Client for ureq::Agent {
|
||||||
.post(endpoint)
|
.post(endpoint)
|
||||||
.header("Sharry-Alias", alias_id)
|
.header("Sharry-Alias", alias_id)
|
||||||
.send_empty()
|
.send_empty()
|
||||||
.map_err(|e| ClientError::req_err(e))?;
|
.map_err(ClientError::req_err)?;
|
||||||
|
|
||||||
trace!("{endpoint:?} response: {res:?}");
|
trace!("{endpoint:?} response: {res:?}");
|
||||||
ClientError::res_check_status(res.status(), ureq::http::StatusCode::OK)?;
|
ClientError::res_check_status(res.status(), ureq::http::StatusCode::OK)?;
|
||||||
|
|
@ -110,7 +110,7 @@ impl Client for ureq::Agent {
|
||||||
let res = res
|
let res = res
|
||||||
.body_mut()
|
.body_mut()
|
||||||
.read_json::<NotifyShareResponse>()
|
.read_json::<NotifyShareResponse>()
|
||||||
.map_err(|e| ClientError::res_parse_err(e))?;
|
.map_err(ClientError::res_parse_err)?;
|
||||||
|
|
||||||
debug!("{res:?}");
|
debug!("{res:?}");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue