Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redundant code from partial download example in chapter 19.4.3? #649

Open
jsomedon opened this issue Aug 13, 2021 · 0 comments
Open

redundant code from partial download example in chapter 19.4.3? #649

jsomedon opened this issue Aug 13, 2021 · 0 comments

Comments

@jsomedon
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant