chore(build): upgrade ureq to 2.0

This commit is contained in:
LongYinan 2021-01-04 11:01:13 +08:00
parent 63b643914b
commit 294563d8dc
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881
3 changed files with 13 additions and 12 deletions

View file

@ -10,7 +10,7 @@ repository = "https://github.com/napi-rs/napi-rs"
version = "1.0.0"
[dependencies]
cfg-if = "1.0"
cfg-if = "1"
[target.'cfg(windows)'.dependencies]
ureq = {version = "1.5.0", default-features = false, features = ["native-tls"]}
ureq = "2"

View file

@ -23,16 +23,17 @@ fn download_node_lib(dist_url: &str, version: &str, arch: &str) -> Vec<u8> {
arch = arch
);
let response = ureq::get(&url).call();
if let Some(error) = response.synthetic_error() {
panic!("Failed to download node.lib: {:#?}", error);
match ureq::get(&url).call() {
Ok(response) => {
let mut reader = response.into_reader();
let mut bytes = vec![];
reader.read_to_end(&mut bytes).unwrap();
bytes
}
Err(error) => {
panic!("Failed to download node.lib: {:#?}", error);
}
}
let mut reader = response.into_reader();
let mut bytes = vec![];
reader.read_to_end(&mut bytes).unwrap();
bytes
}
pub fn setup() {

View file

@ -26,7 +26,7 @@ tokio_rt = ["futures", "tokio", "once_cell"]
napi-sys = {version = "1", path = "../sys"}
[target.'cfg(windows)'.dependencies]
winapi = "0.3.9"
winapi = {version = "0.3.9", features = ["winuser", "minwindef", "ntdef", "libloaderapi"]}
[dependencies.encoding_rs]
optional = true