Skip to content

Commit

Permalink
More compact way to return enroll response
Browse files Browse the repository at this point in the history
Co-authored-by: MOZGIII <[email protected]>
  • Loading branch information
dmitrylavrenov and MOZGIII committed Sep 16, 2024
1 parent 9507dd2 commit e37b3ba
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions crates/robonode-client/src/enroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ impl Client {
let url = format!("{}/enroll", self.base_url);
let res = self.reqwest.post(url).json(&req).send().await?;
match res.status() {
StatusCode::CREATED => {
if let Some(0) = res.content_length() {
Ok(EnrollResponse {
scan_result_blob: None,
})
} else {
Ok(res.json().await?)
}
}
StatusCode::CREATED if res.content_length() == Some(0) => Ok(EnrollResponse {
scan_result_blob: None,
})
StatusCode::CREATED => Ok(res.json().await?),
status => Err(Error::Call(EnrollError::from_response(
status,
res.text().await?,
Expand Down

0 comments on commit e37b3ba

Please sign in to comment.