Repository: seanmonstar/reqwest (language: rust)

Issue:
`wasm::multipart`: missing `fn headers()`
Currently (v0.11.22), compiling for `--target=wasm32-unknown-unknown` leads to a missing `fn headers()` for setting the headers of a multipart form. It seems to me, that the wasm implementation is simply missing the method `fn headers` in `impl Part` and `impl PartMetadata` respectively. I have forked the repository, added the two missing methods into a branch based on tag 0.11.2, and reqwest compiles just fine for the wasm target. I haven't been able to test the method yet though.

Was it intended for these functions to be missing for wasm? 


Discussion / hints:

Fix patch:
diff --git a/src/wasm/multipart.rs b/src/wasm/multipart.rs
index 909875c0a..f676784d2 100644
--- a/src/wasm/multipart.rs
+++ b/src/wasm/multipart.rs
@@ -172,6 +172,11 @@ impl Part {
         self.with_inner(move |inner| inner.file_name(filename))
     }
 
+    /// Sets custom headers for the part.
+    pub fn headers(self, headers: HeaderMap) -> Part {
+        self.with_inner(move |inner| inner.headers(headers))
+    }
+
     fn with_inner<F>(self, func: F) -> Self
     where
         F: FnOnce(PartMetadata) -> PartMetadata,
@@ -262,6 +267,14 @@ impl PartMetadata {
         self.file_name = Some(filename.into());
         self
     }
+
+    pub(crate) fn headers<T>(mut self, headers: T) -> Self
+    where
+        T: Into<HeaderMap>,
+    {
+        self.headers = headers.into();
+        self
+    }
 }
 
 impl PartMetadata {


Test patch: