Struct reqwest::multipart::Form
[−]
[src]
pub struct Form { /* fields omitted */ }
A multipart/form-data request.
Methods
impl Form
[src]
fn new() -> Form
[src]
Creates a new Form without any content.
fn boundary(&self) -> &str
[src]
Get the boundary that this form will use.
fn text<T, U>(self, name: T, value: U) -> Form where
T: Into<Cow<'static, str>>,
U: Into<Cow<'static, str>>,
[src]
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");
fn file<T, U>(self, name: T, path: U) -> Result<Form> where
T: Into<Cow<'static, str>>,
U: AsRef<Path>,
[src]
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.
fn part<T>(self, name: T, part: Part) -> Form where
T: Into<Cow<'static, str>>,
[src]
T: Into<Cow<'static, str>>,
Adds a customized Part.