In the code example I see these two lines in the end:
let content = response.text()?;
std::io::copy(&mut content.as_bytes(), &mut output_file)?;
Looks like the first line is getting text from response of previous .head() call -- that should be empty string? Then the second line turns that text into bytes then appends to the output_file -- output_file should already contain content of the file to be downloaded, that's done by the for loop above these two lines. So I wonder if these lines are necessary, or am I missing something here?
In the code example I see these two lines in the end:
Looks like the first line is getting text from response of previous
.head()
call -- that should be empty string? Then the second line turns that text into bytes then appends to theoutput_file
--output_file
should already contain content of the file to be downloaded, that's done by the for loop above these two lines. So I wonder if these lines are necessary, or am I missing something here?