Private
Public Access
1
0

wip: attachment MIME

This commit is contained in:
2025-09-10 13:48:27 -07:00
parent 469fd8fa13
commit 4e8b161d26
5 changed files with 208 additions and 17 deletions

View File

@@ -618,6 +618,27 @@ impl<K: AuthenticationStore + Send + Sync> HTTPAPIClient<K> {
Ok(response)
}
// Fetch an attachment while preserving response headers (e.g., Content-Type).
// Returns the streaming body and the Content-Type header if present.
pub async fn fetch_attachment_with_metadata(
&mut self,
guid: &str,
preview: bool,
) -> Result<(ResponseStream, Option<String>), Error> {
let endpoint = format!("attachment?guid={}&preview={}", guid, preview);
let response = self
.response_with_body_retry(&endpoint, Method::GET, Body::empty, true)
.await?;
let content_type = response
.headers()
.get(hyper::header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.map(|s| s.to_string());
Ok((ResponseStream::from(response.into_body()), content_type))
}
}
#[cfg(test)]