Multipart form requests
So far in this chapter, we have used requests with binary bodies. This is suitable for microservices, but if you want to send files with an HTML form, you should use a request with a multipart/form-data type of content. This allows a client to include multiple files in a single request, but it also needs a parser to split files from the body of a request. The hyper crate doesn't include a parser for multipart requests, and you can use other crates such as the multipart crate to parse requests instead. This, however, doesn't work asynchronously, so you should use the multipart-async crate with the latest versions of the hyper crate. You can also implement multipart requests yourself. To implement this, you can create ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access