Skip to content

Commit

Permalink
log response status in debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Oct 11, 2024
1 parent 956cec1 commit 241bdac
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libs/sdk-common/src/utils/rest_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ pub async fn post_and_log_response(
if let Some(body) = body {
req = req.body(body);
}
let raw_body = req.send().await?.text().await?;
trace!("Received raw response body: {raw_body}");
let response = req.send().await?;
let status = response.status();
let raw_body = response.text().await?;
debug!("Received response, status: {status}");
trace!("raw response body: {raw_body}");

Ok(raw_body)
}
Expand All @@ -40,7 +43,8 @@ pub async fn get_and_log_response(
let response = get_reqwest_client()?.get(url).send().await?;
let status = response.status();
let raw_body = response.text().await?;
trace!("Received response, status: {status}, raw response body: {raw_body}");
debug!("Received response, status: {status}");
trace!("raw response body: {raw_body}");

Ok((raw_body, status))
}
Expand Down

0 comments on commit 241bdac

Please sign in to comment.