use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct KeyValuePair { pub key: String, pub value: String, } #[derive(Debug, Deserialize)] pub enum FormDataValue { Text(String), File { filename: String, data: Vec, mime: String, }, } #[derive(Debug, Deserialize)] pub struct FormDataEntry { pub key: String, pub value: FormDataValue, } #[derive(Debug, Deserialize)] pub enum BodyDef { Text(String), URLEncoded(Vec), FormData(Vec), } #[derive(Debug, Deserialize)] pub struct RequestWithMetadata { pub req_id: usize, pub method: String, pub endpoint: String, pub headers: Vec, pub body: Option, pub validate_certs: bool, pub root_cert_bundle_files: Vec>, pub client_cert: Option, pub proxy: Option, } impl RequestWithMetadata { pub fn new( req_id: usize, method: String, endpoint: String, headers: Vec, body: Option, validate_certs: bool, root_cert_bundle_files: Vec>, client_cert: Option, proxy: Option, ) -> Self { Self { req_id, method, endpoint, headers, body, validate_certs, root_cert_bundle_files, client_cert, proxy, } } } #[derive(Debug, Deserialize)] pub struct ProxyConfig { pub url: String, } #[derive(Debug, Deserialize)] pub enum ClientCertDef { PEMCert { certificate_pem: Vec, key_pem: Vec, }, PFXCert { certificate_pfx: Vec, password: String, }, } #[derive(Debug, Serialize)] pub struct ResponseWithMetadata { pub status: u16, pub status_text: String, pub headers: Vec, pub data: Vec, pub time_start_ms: u128, pub time_end_ms: u128, }