INNER CODE UNIT · Rust
remote
orhun/git-cliff · git-cliff-core/src/remote/mod.rs:165
fn remote(&self) -> Remote;
/// Returns the HTTP client for making requests.
fn client(&self) -> ClientWithMiddleware;
/// Performs a HTTP GET request, deserializes the JSON response, and returns the result.
/// This is the core HTTP request and JSON parsing logic shared by all API methods.
/// Callers are responsible for any additional processing of the deserialized data.
async fn get_json<T: DeserializeOwned>(&self, url: &str) -> Result<T> {
tracing::debug!("Sending request to: {url}");
let response = self.client().get(url).send().await?.error_for_status()?;
let response_text = if response.status().is_success() {
let text = response.text().await?;
tracing::trace!("Response: {text:?}");
text
} else {
let text = response.text().await?;
tracing::error!("Request error: {text}");