added client certs to request struct
All checks were successful
build / docker (push) Successful in 12m3s

This commit is contained in:
Wyatt J. Miller 2024-11-10 16:41:37 -05:00
parent 8f00d4ec4c
commit 97190d913f

View File

@ -1,6 +1,8 @@
use reqwest::StatusCode;
use std::time::Duration;
pub struct Request<'a> {
pub client: reqwest::Client,
pub base_url: &'a str,
pub full_url: Option<&'a str>,
}
@ -8,6 +10,11 @@ pub struct Request<'a> {
impl<'a> Request<'a> {
pub fn new() -> Self {
Request {
client: reqwest::ClientBuilder::new()
.use_rustls_tls()
.timeout(Duration::from_secs(30))
.build()
.unwrap(),
base_url: "https://site.api.espn.com/apis/site/v2/sports/football",
full_url: None,
}
@ -26,7 +33,7 @@ impl<'a> Request<'a> {
T: for<'de> serde::Deserialize<'de>,
{
println!("{}", url);
let api_result = match reqwest::get(url).await {
let api_result = match self.client.get(url).send().await {
Ok(r) => r,
Err(e) => return Err(Box::new(e)),
};