(url: &str)
| 548 | // --------------------------------------------------------------------------- |
| 549 | |
| 550 | async fn fetch_url(url: &str) -> Result<String, reqwest::Error> { |
| 551 | let client = reqwest::Client::builder() |
| 552 | .timeout(std::time::Duration::from_secs(5)) |
| 553 | .build()?; |
| 554 | let resp = client.get(url).send().await?; |
| 555 | if resp.status().is_success() { |
| 556 | resp.text().await |
| 557 | } else { |
| 558 | Ok(String::new()) |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | // --------------------------------------------------------------------------- |
| 563 | // Tests |