pub enum BodyFormat {
FormUrlEncoded,
Json,
Text,
FormData(String),
Custom(String),
}Expand description
请求体格式定义
支持多种常见的请求体格式,包括表单、JSON、纯文本等。
§示例
use zlsrs::zhttp::BodyFormat;
let format = BodyFormat::Json;
assert_eq!(format.content_type(), "application/json");Variants§
FormUrlEncoded
application/x-www-form-urlencoded 格式 用于普通的表单提交
Json
application/json 格式 用于 JSON 数据传输
Text
text/plain 格式 用于纯文本数据
FormData(String)
multipart/form-data 格式 用于文件上传等场景,需要指定 boundary
Custom(String)
自定义 Content-Type 格式 用于不在预定义范围内的格式
Implementations§
Source§impl BodyFormat
impl BodyFormat
pub fn content_type(&self) -> String
Trait Implementations§
Source§impl Clone for BodyFormat
impl Clone for BodyFormat
Source§fn clone(&self) -> BodyFormat
fn clone(&self) -> BodyFormat
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 BodyFormat
impl Debug for BodyFormat
Source§impl PartialEq for BodyFormat
impl PartialEq for BodyFormat
impl StructuralPartialEq for BodyFormat
Auto Trait Implementations§
impl Freeze for BodyFormat
impl RefUnwindSafe for BodyFormat
impl Send for BodyFormat
impl Sync for BodyFormat
impl Unpin for BodyFormat
impl UnwindSafe for BodyFormat
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