Skip to content

Commit 2ade7f5

Browse files
authored
Merge pull request #162 from robertknight/ureq-3
Update to ureq v3.x
2 parents 492956b + 227f022 commit 2ade7f5

File tree

3 files changed

+80
-68
lines changed

3 files changed

+80
-68
lines changed

Cargo.lock

Lines changed: 74 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ocrs-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ url = "2.5.2"
2121
anyhow = "1.0.95"
2222

2323
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
24-
ureq = "2.11.0"
24+
ureq = "3.0.5"
2525
home = "0.5.9"
2626

2727
[features]

ocrs-cli/src/models.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::fmt;
2+
use std::io::Read;
23
use std::path::PathBuf;
34

45
#[cfg(not(target_arch = "wasm32"))]
@@ -53,11 +54,11 @@ fn download_file(url: &str, filename: Option<&str>) -> Result<PathBuf, anyhow::E
5354

5455
eprintln!("Downloading {}...", url);
5556

56-
let mut reader = ureq::get(url).call()?.into_reader();
57-
let mut body = Vec::new();
58-
reader.read_to_end(&mut body)?;
57+
let mut body = ureq::get(url).call()?.into_body();
58+
let mut buf = Vec::new();
59+
body.as_reader().read_to_end(&mut buf)?;
5960

60-
fs::write(&file_path, &body)?;
61+
fs::write(&file_path, &buf)?;
6162

6263
Ok(file_path)
6364
}

0 commit comments

Comments
 (0)