pub struct Form { /* private fields */ }Available on non-WebAssembly and crate feature
multipart only.Expand description
An async multipart/form-data request.
Implementations§
Source§impl Form
impl Form
Sourcepub fn set_boundary(&mut self, boundary: impl Into<String>)
pub fn set_boundary(&mut self, boundary: impl Into<String>)
Set the boundary that this form will use. By default the boundary is a long random string to minimize the risk of the boundary appearing in the body content.
Setting a custom boundary incurs significant risk of generating corrupted bodies. Only use this if you need it and you understand the risk!
Sourcepub fn text<T, U>(self, name: T, value: U) -> Form
pub fn text<T, U>(self, name: T, value: U) -> Form
Add a data field with supplied name and value.
§Examples
let form = reqwest::multipart::Form::new()
.text("username", "seanmonstar")
.text("password", "secret");Sourcepub async fn file<T, U>(self, name: T, path: U) -> Result<Form>
Available on crate feature stream only.
pub async fn file<T, U>(self, name: T, path: U) -> Result<Form>
stream only.Sourcepub fn percent_encode_path_segment(self) -> Form
pub fn percent_encode_path_segment(self) -> Form
Configure this Form to percent-encode using the path-segment rules.
Sourcepub fn percent_encode_attr_chars(self) -> Form
pub fn percent_encode_attr_chars(self) -> Form
Configure this Form to percent-encode using the attr-char rules.
Sourcepub fn percent_encode_noop(self) -> Form
pub fn percent_encode_noop(self) -> Form
Configure this Form to skip percent-encoding
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Form
impl !RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin for Form
impl !UnwindSafe for Form
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