Struct reqwest::multipart::Form [−][src]
pub struct Form { /* fields omitted */ }A multipart/form-data request.
Methods
impl Form[src]
impl Formpub fn new() -> Form[src]
pub fn new() -> FormCreates a new Form without any content.
pub fn boundary(&self) -> &str[src]
pub fn boundary(&self) -> &strGet the boundary that this form will use.
pub fn text<T, U>(self, name: T, value: U) -> Form where
T: Into<Cow<'static, str>>,
U: Into<Cow<'static, str>>, [src]
pub fn text<T, U>(self, name: T, value: U) -> Form where
T: Into<Cow<'static, str>>,
U: Into<Cow<'static, str>>, Add a data field with supplied name and value.
Examples
let form = reqwest::multipart::Form::new() .text("username", "seanmonstar") .text("password", "secret");
pub fn file<T, U>(self, name: T, path: U) -> Result<Form> where
T: Into<Cow<'static, str>>,
U: AsRef<Path>, [src]
pub fn file<T, U>(self, name: T, path: U) -> Result<Form> where
T: Into<Cow<'static, str>>,
U: AsRef<Path>, Adds a file field.
The path will be used to try to guess the filename and mime.
Examples
let files = reqwest::multipart::Form::new() .file("key", "/path/to/file")?;
Errors
Errors when the file cannot be opened.
pub fn part<T>(self, name: T, part: Part) -> Form where
T: Into<Cow<'static, str>>, [src]
pub fn part<T>(self, name: T, part: Part) -> Form where
T: Into<Cow<'static, str>>, Adds a customized Part.