Skip to content

Commit

Permalink
test: use into_form_stream for form test
Browse files Browse the repository at this point in the history
  • Loading branch information
fMeow committed May 29, 2021
1 parent 2f043e0 commit 61bf8de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions tests/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ async fn multipart() {
files: vec![("photo".to_owned(), FilePart::new(photo_headers, &tmppath))],
};

let boundary = generate_boundary();
let multipart = form.to_multipart().unwrap();
let (count, reader) = multipart_to_read(boundary.clone(), multipart).unwrap();
let stream = form.into_form_stream().unwrap();
let boundary = stream.boundary;
let reader = stream.reader;
let count = stream.count;

let client = Client::new(HeaderMap::new()).unwrap();
let req = Request::post("https://httpbin.org/post")
Expand Down
7 changes: 4 additions & 3 deletions tests/surf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ async fn multipart() {
files: vec![("photo".to_owned(), FilePart::new(photo_headers, &tmppath))],
};

let boundary = generate_boundary();
let multipart = form.to_multipart().unwrap();
let (count, reader) = multipart_to_read(boundary.clone(), multipart).unwrap();
let stream = form.into_form_stream().unwrap();
let boundary = stream.boundary;
let reader = stream.reader;
let count = stream.count;

let client = Client::new(HeaderMap::new()).unwrap();
let req = Request::post("https://httpbin.org/post")
Expand Down

0 comments on commit 61bf8de

Please sign in to comment.