Struct hop_cli::state::http::HttpClient
source · pub struct HttpClient {
pub client: AsyncClient,
pub base_url: String,
pub headers: HeaderMap,
pub ua: String,
}Fields
client: AsyncClientbase_url: Stringheaders: HeaderMapua: StringImplementations
sourceimpl HttpClient
impl HttpClient
pub fn new(token: Option<String>, api_url: Option<String>) -> Self
pub async fn handle_response<T>(&self, response: Response) -> Result<Option<T>>where
T: DeserializeOwned,
pub async fn request<T>(
&self,
method: &str,
path: &str,
data: Option<(Body, &str)>
) -> Result<Option<T>>where
T: DeserializeOwned,
Trait Implementations
sourceimpl Clone for HttpClient
impl Clone for HttpClient
sourcefn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more