Skip to content

Commit f7d929f

Browse files
authored
feat: Add a Form::into_reader() method on blocking multipart forms. (#2524)
An example use case is compressing multipart form data with zstd. The entire contents of the payload have to be compressed together, which requires accessing the contents of the `Form`. The existing reader functionality already implements what we need, but just isn't publicly accessible. This PR adds a `pub` method for it.
1 parent 8b8fdd2 commit f7d929f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/blocking/multipart.rs

+5
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ impl Form {
148148
Reader::new(self)
149149
}
150150

151+
/// Produce a reader over the multipart form data.
152+
pub fn into_reader(self) -> impl Read {
153+
self.reader()
154+
}
155+
151156
// If predictable, computes the length the request will have
152157
// The length should be predictable if only String and file fields have been added,
153158
// but not if a generic reader has been added;

0 commit comments

Comments
 (0)