pub struct HttpClient { /* private fields */ }Expand description
HTTP 客户端封装
提供统一的 HTTP 请求方法,处理 URL 编码和响应解析
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn with_defaults() -> ZtkResult<Self>
pub fn with_defaults() -> ZtkResult<Self>
使用默认配置创建 HTTP 客户端
使用默认的 API 基础地址和超时时间
Sourcepub async fn get_with_base_url<T, P>(
&self,
base_url: &str,
path: &str,
params: &P,
) -> ZtkResult<T>
pub async fn get_with_base_url<T, P>( &self, base_url: &str, path: &str, params: &P, ) -> ZtkResult<T>
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more