Skip to content

Commit

Permalink
Merge branch 'dsharifi/add-max-header-list-size-to-client-builder' of…
Browse files Browse the repository at this point in the history
… github.com:DSharifi/reqwest into dsharifi/add-max-header-list-size-to-client-builder
  • Loading branch information
DSharifi committed Oct 29, 2024
2 parents ddddde1 + 8817f1e commit f18fcf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/async_impl/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ impl Part {
let len = file.metadata().await.map(|m| m.len()).ok();
let field = match len {
Some(len) => Part::stream_with_length(file, len),
None => Part::stream(file)
}.mime(mime);
None => Part::stream(file),
}
.mime(mime);

Ok(if let Some(file_name) = file_name {
field.file_name(file_name)
Expand Down
7 changes: 5 additions & 2 deletions tests/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ async fn async_impl_file_part() {
async move {
assert_eq!(req.method(), "POST");
assert_eq!(req.headers()["content-type"], ct);
assert_eq!(req.headers()["transfer-encoding"], "chunked");

// files know their exact size
assert_eq!(
req.headers()["content-length"],
expected_body.len().to_string()
);
let full = req.collect().await.unwrap().to_bytes();

assert_eq!(full, expected_body.as_bytes());
Expand Down

0 comments on commit f18fcf0

Please sign in to comment.