Merge pull request #395 from napi-rs/ureq-2

chore(build): upgrade ureq to 2.0
This commit is contained in:
LongYinan 2021-01-04 14:34:35 +08:00 committed by GitHub
commit 3bea6bba5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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" version = "1.0.0"
[dependencies] [dependencies]
cfg-if = "1.0" cfg-if = "1"
[target.'cfg(windows)'.dependencies] [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 arch = arch
); );
let response = ureq::get(&url).call(); match ureq::get(&url).call() {
if let Some(error) = response.synthetic_error() { Ok(response) => {
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
}
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() { pub fn setup() {

View file

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