pub struct HttpClient { /* private fields */ }Expand description
Cliente HTTP con base URL, timeouts y reintentos.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(base_url: &str, cfg: TransportConfig) -> Result<Self, TransportError>
pub fn new(base_url: &str, cfg: TransportConfig) -> Result<Self, TransportError>
Crea el cliente. base_url sin barra final, p. ej. https://iqoption.com/api.
Sourcepub async fn post_json(
&self,
path: &str,
cuerpo: &Value,
) -> Result<Value, TransportError>
pub async fn post_json( &self, path: &str, cuerpo: &Value, ) -> Result<Value, TransportError>
POST JSON con reintentos. El cuerpo viaja como serde_json::Value.
Sourcepub async fn post_json_completo(
&self,
path: &str,
cuerpo: &Value,
) -> Result<(Value, HeaderMap), TransportError>
pub async fn post_json_completo( &self, path: &str, cuerpo: &Value, ) -> Result<(Value, HeaderMap), TransportError>
POST JSON devolviendo también las cabeceras de respuesta
(necesario para leer Set-Cookie: ssid=… del login).
Auto Trait Implementations§
impl !RefUnwindSafe for HttpClient
impl !UnwindSafe for HttpClient
impl Forget for HttpClient
impl Freeze for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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