Skip to content

Commit

Permalink
fn headers() for wasm::multipart (#2036)
Browse files Browse the repository at this point in the history
* Add missing headers() method to wasm::multipart

* Remove duplicate import

* Add headers() to impl PartMetadata
  • Loading branch information
bitfl0wer authored Nov 13, 2023
1 parent 52190df commit 6792f69
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/wasm/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6792f69

Please sign in to comment.