pub enum Body {
Json(Value),
Form(DashMap<String, String>),
Bytes(Bytes),
}Expand description
Request body variants supported by the default downloader.
§Example
ⓘ
use spider_util::request::Body;
use serde_json::json;
use dashmap::DashMap;
use bytes::Bytes;
// JSON body
let json_body = Body::Json(json!({"name": "test"}));
// Form data
let mut form = DashMap::new();
form.insert("key".to_string(), "value".to_string());
let form_body = Body::Form(form);
// Raw bytes
let bytes_body = Body::Bytes(Bytes::from("raw data"));Variants§
Json(Value)
JSON payload.
Form(DashMap<String, String>)
Form data (key-value pairs).
Bytes(Bytes)
Raw binary data.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Body
impl<'de> Deserialize<'de> for Body
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Body, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Body, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Body
impl Serialize for Body
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl !Freeze for Body
impl !RefUnwindSafe for Body
impl Send for Body
impl Sync for Body
impl Unpin for Body
impl UnsafeUnpin for Body
impl UnwindSafe for Body
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