|
|
@ -2,9 +2,15 @@ |
|
|
|
//! In the future, if we want to migrate to a different HTTP library,
|
|
|
|
//! In the future, if we want to migrate to a different HTTP library,
|
|
|
|
//! we can easily change this facade instead of multiple places in the crate.
|
|
|
|
//! we can easily change this facade instead of multiple places in the crate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use reqwest::blocking::Client; |
|
|
|
|
|
|
|
|
|
|
|
pub type Error = reqwest::Error; |
|
|
|
pub type Error = reqwest::Error; |
|
|
|
pub type Response = reqwest::blocking::Response; |
|
|
|
pub type Response = reqwest::blocking::Response; |
|
|
|
|
|
|
|
|
|
|
|
pub fn get(url: &str) -> Result<Response, Error> { |
|
|
|
pub fn get(url: &str) -> Result<Response, Error> { |
|
|
|
reqwest::blocking::get(url) |
|
|
|
Client::new() |
|
|
|
|
|
|
|
.get(url) |
|
|
|
|
|
|
|
// Some sites require a user agent.
|
|
|
|
|
|
|
|
.header("User-Agent", concat!("fnm ", env!("CARGO_PKG_VERSION"))) |
|
|
|
|
|
|
|
.send() |
|
|
|
} |
|
|
|
} |
|
|
|