From 6792f697fcdb27c47dcbf7bd05f23368d1d4ac80 Mon Sep 17 00:00:00 2001 From: Flori <39242991+bitfl0wer@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:30:03 +0100 Subject: [PATCH] `fn headers()` for wasm::multipart (#2036) * Add missing headers() method to wasm::multipart * Remove duplicate import * Add headers() to impl PartMetadata --- src/wasm/multipart.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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(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(mut self, headers: T) -> Self + where + T: Into, + { + self.headers = headers.into(); + self + } } impl PartMetadata {