use http::HeaderMap;
use http::HeaderValue;
use qubit_redact::RedactionPolicy;
use qubit_redact::Redactor;
use qubit_redact::formats::http::BodyCapture;
pub(crate) fn redact_body(redactor: &Redactor, capture: BodyCapture<'_>, content_type: Option<&HeaderValue>) -> String {
redactor
.redact_http_body(capture, content_type)
.text()
.as_str()
.to_owned()
}
pub(crate) fn redact_url(redactor: &Redactor, value: &str) -> String {
redactor.redact_http_url(value).text().as_str().to_owned()
}
pub(crate) fn redact_headers(policy: RedactionPolicy, headers: &HeaderMap) -> String {
Redactor::new(policy)
.text_composer()
.http(|http| {
http.headers(headers);
})
.finish()
.text()
.as_str()
.to_owned()
}