fix: fix some issues
This commit is contained in:
@@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_with::serde_as;
|
||||
use snafu::Snafu;
|
||||
|
||||
use crate::get_random_mobile_ua;
|
||||
use crate::get_random_ua;
|
||||
|
||||
pub struct RateLimiterMiddleware {
|
||||
rate_limiter: RateLimiter,
|
||||
@@ -176,7 +176,7 @@ impl HttpClient {
|
||||
config
|
||||
.user_agent
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| get_random_mobile_ua()),
|
||||
.unwrap_or_else(|| get_random_ua()),
|
||||
);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
@@ -291,7 +291,7 @@ impl HttpClient {
|
||||
self.config
|
||||
.user_agent
|
||||
.as_deref()
|
||||
.unwrap_or_else(|| get_random_mobile_ua()),
|
||||
.unwrap_or_else(|| get_random_ua()),
|
||||
);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
@@ -5,7 +5,7 @@ lazy_static! {
|
||||
serde_json::from_str::<Vec<String>>(include_str!("./ua.json")).unwrap();
|
||||
}
|
||||
|
||||
pub fn get_random_mobile_ua() -> &'static str {
|
||||
pub fn get_random_ua() -> &'static str {
|
||||
DEFAULT_HTTP_CLIENT_USER_AGENT[fastrand::usize(0..DEFAULT_HTTP_CLIENT_USER_AGENT.len())]
|
||||
.as_str()
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ pub mod html;
|
||||
pub mod image;
|
||||
pub mod test_util;
|
||||
|
||||
pub use core::get_random_mobile_ua;
|
||||
pub use core::get_random_ua;
|
||||
|
||||
pub use bytes::fetch_bytes;
|
||||
pub use client::{HttpClient, HttpClientConfig, HttpClientError, HttpClientTrait};
|
||||
|
||||
Reference in New Issue
Block a user