Skip to content

Commit cc6a05c

Browse files
bl2eXAMPPRocky
andauthored
upgrade function calls to reqwest in issue #1059 (#1084)
* upgrade function calls to reqwest in issue #1059 bumping reqwest 0.9.24 to 0.10.4 requires use of calls that block * Update src/rust_version.rs Formatting updated Co-Authored-By: XAMPPRocky <[email protected]> Co-authored-by: XAMPPRocky <[email protected]>
1 parent 8918464 commit cc6a05c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rocket = "0.4.1"
1717
serde = { version = "1.0", features = ["derive"] }
1818
serde_yaml = "0.8.7"
1919
sass-rs = "0.2.1"
20-
reqwest = "0.9"
20+
reqwest = { version = "0.10.4", features = ["blocking", "json"] }
2121
toml = "0.5"
2222
serde_json = "1.0"
2323
rust_team_data = { git = "https://github.com/rust-lang/team" }

src/rust_version.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@ enum FetchTarget {
1010
ReleasesFeed,
1111
}
1212

13-
fn fetch(target: FetchTarget) -> Result<reqwest::Response, Box<dyn Error>> {
13+
fn fetch(target: FetchTarget) -> Result<reqwest::blocking::Response, Box<dyn Error>> {
1414
let proxy_env = env::var("http_proxy")
1515
.or_else(|_| env::var("HTTPS_PROXY"))
1616
.ok();
1717

1818
let client = match proxy_env {
1919
Some(proxy_env) => {
2020
let proxy = reqwest::Proxy::https(&proxy_env).unwrap();
21-
reqwest::ClientBuilder::new().proxy(proxy).build().unwrap()
21+
reqwest::blocking::ClientBuilder::new()
22+
.proxy(proxy)
23+
.build()
24+
.unwrap()
2225
}
23-
None => reqwest::Client::new(),
26+
None => reqwest::blocking::Client::new(),
2427
};
2528

2629
let url = match target {

src/teams.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn page_data(section: &str, team_name: &str) -> Result<PageData, Box<dyn Err
116116
}
117117

118118
fn get_teams() -> Result<Box<dyn Any>, Box<dyn Error>> {
119-
let resp: Teams = reqwest::get(&format!("{}/teams.json", BASE_URL))?
119+
let resp: Teams = reqwest::blocking::get(&format!("{}/teams.json", BASE_URL))?
120120
.error_for_status()?
121121
.json()?;
122122

0 commit comments

Comments
 (0)