Sometimes you have to interact with HTML forms or upload files. This usually requires handling the multipart/form-data encoding.
Forms can mix files and text data, and there can be multiple different fields within a form. Thus, it requires a way to express multiple fields in the same request and some of those fields can be binary files.
That's why encoding data in multipart can get tricky, but it's possible to roll out a basic recipe using only standard library tools that will work in most cases.