feat(core): Add masking support for form-data types request (#9496)

Co-authored-by: Sayak Bhattacharya <sayak.b@Sayak-Bhattacharya-G092THXJ34.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sayak Bhattacharya
2025-10-07 22:22:43 +05:30
committed by GitHub
parent d98adb2e03
commit 1af7f42762
10 changed files with 84 additions and 57 deletions

View File

@ -1,4 +1,5 @@
use masking::{Maskable, Secret};
use reqwest::multipart::Form;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
@ -66,7 +67,7 @@ impl std::fmt::Debug for RequestContent {
pub enum RequestContent {
Json(Box<dyn masking::ErasedMaskSerialize + Send>),
FormUrlEncoded(Box<dyn masking::ErasedMaskSerialize + Send>),
FormData(reqwest::multipart::Form),
FormData((Form, Box<dyn masking::ErasedMaskSerialize + Send>)),
Xml(Box<dyn masking::ErasedMaskSerialize + Send>),
RawBytes(Vec<u8>),
}
@ -77,7 +78,7 @@ impl RequestContent {
Self::Json(i) => serde_json::to_string(&i).unwrap_or_default().into(),
Self::FormUrlEncoded(i) => serde_urlencoded::to_string(i).unwrap_or_default().into(),
Self::Xml(i) => quick_xml::se::to_string(&i).unwrap_or_default().into(),
Self::FormData(_) => String::new().into(),
Self::FormData((_, i)) => serde_json::to_string(i).unwrap_or_default().into(),
Self::RawBytes(_) => String::new().into(),
}
}