pub enum RequestBody {
Json(Value),
BinaryFile {
path: String,
content_type: Option<String>,
},
}
Expand description
Request body types supported by MockForge
Variants§
Implementations§
Source§impl RequestBody
impl RequestBody
Sourcepub fn binary_file(path: String, content_type: Option<String>) -> Self
pub fn binary_file(path: String, content_type: Option<String>) -> Self
Create a binary file request body
Sourcepub async fn to_bytes(&self) -> Result<Vec<u8>>
pub async fn to_bytes(&self) -> Result<Vec<u8>>
Convert the request body to bytes for HTTP transmission
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Get the content type for this request body
Trait Implementations§
Source§impl Clone for RequestBody
impl Clone for RequestBody
Source§fn clone(&self) -> RequestBody
fn clone(&self) -> RequestBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RequestBody
impl Debug for RequestBody
Source§impl<'de> Deserialize<'de> for RequestBody
impl<'de> Deserialize<'de> for RequestBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RequestBody
impl RefUnwindSafe for RequestBody
impl Send for RequestBody
impl Sync for RequestBody
impl Unpin for RequestBody
impl UnwindSafe for RequestBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more