forked from mirror/Riven
1
0
Fork 0

moving stuff around make work no publish thanks

feat-middleware
Zynh0722 2024-02-09 01:07:42 -08:00
parent 595553dcaf
commit fdad6dd0c4
3 changed files with 4 additions and 7 deletions

View File

@ -44,7 +44,7 @@ log = "0.4"
num_enum = "0.5"
parking_lot = "0.12"
reqwest = { version = "0.11", default-features = false, features = [ "gzip", "json" ] }
reqwest-middleware = "0.2.4"
reqwest-middleware = { git = "https://git.zynh.me/Zynh0722/reqwest-middleware.git" }
scan_fmt = { version = "0.2", default-features = false }
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"

View File

@ -2,7 +2,7 @@
use std::time::Duration;
use reqwest::header::{HeaderMap, HeaderValue};
use reqwest::ClientBuilder;
use reqwest_middleware::ClientBuilder;
/// Configuration for instantiating RiotApi.
#[derive(Debug)]
@ -80,7 +80,7 @@ impl RiotApiConfig {
method_rate_usage_factor: Self::DEFAULT_RATE_USAGE_FACTOR,
burst_factor: Self::PRECONFIG_BURST_BURST_FACTOR,
duration_overhead: Self::PRECONFIG_BURST_DURATION_OVERHEAD,
client_builder: Some(ClientBuilder::new().default_headers(default_headers)),
client_builder: Some(ClientBuilder::new(reqwest::ClientBuilder::new().default_headers(default_headers).build().unwrap())),
}
}

View File

@ -60,10 +60,7 @@ impl RiotApi {
.expect("CLIENT_BUILDER IN CONFIG SHOULD NOT BE NONE.");
Self {
config,
client: client_builder
.build()
.expect("Failed to create client from builder.")
.into(),
client: client_builder.build(),
regional_requesters: InsertOnlyCHashMap::new(),
}
}