diff --git a/src/agent/api/http.rs b/src/agent/api/http.rs index 65b759b..a059426 100644 --- a/src/agent/api/http.rs +++ b/src/agent/api/http.rs @@ -154,6 +154,14 @@ impl HttpResponse { Ok(String::from_utf8_lossy(&bytes).into_owned()) } + /// Read the entire body as raw bytes (for binary downloads). + pub async fn bytes(self) -> Result { + let bytes = self.body.collect().await + .context("reading response body")? + .to_bytes(); + Ok(bytes) + } + /// Read the entire body and deserialize as JSON. pub async fn json(self) -> Result { let bytes = self.body.collect().await