Module reqwest::blocking::multipart [−][src]
multipart/form-data
To send a multipart/form-data
body, a Form
is built up, adding
fields or customized Part
s, and then calling the
multipart
method on the RequestBuilder
.
Example
use reqwest::blocking::multipart; let form = multipart::Form::new() // Adding just a simple text field... .text("username", "seanmonstar") // And a file... .file("photo", "/path/to/photo.png")?; // Customize all the details of a Part if needed... let bio = multipart::Part::text("hallo peeps") .file_name("bio.txt") .mime_str("text/plain")?; // Add the custom part to our form... let form = form.part("biography", bio); // And finally, send the form let client = reqwest::blocking::Client::new(); let resp = client .post("http://localhost:8080/user") .multipart(form) .send()?;
Structs
Form | A multipart/form-data request. |
Part | A field in a multipart form. |