pub struct HttpClient { /* private fields */ }Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(browser_profile: BrowserProfile) -> Result<Self, NetError>
pub fn new(browser_profile: BrowserProfile) -> Result<Self, NetError>
Create a new client with the given browser profile.
Build a client that participates in the process-wide shared session.
pub fn browser_profile(&self) -> &BrowserProfile
Sourcepub fn has_accept_ch(&self, host: &str) -> bool
pub fn has_accept_ch(&self, host: &str) -> bool
Whether host has previously sent Accept-CH.
Snapshot all cookies for a URL.
Inject cookies from external sources (e.g., JS document.cookie).
Set a single cookie from a raw Set-Cookie-style string.
Drop all cookies matching target_domain.
Sourcepub async fn get_with_headers(
&self,
url: &str,
extra_headers: &[(String, String)],
) -> Result<Response, NetError>
pub async fn get_with_headers( &self, url: &str, extra_headers: &[(String, String)], ) -> Result<Response, NetError>
GET with extra headers.
Sourcepub async fn fetch_get(
&self,
url: &str,
extra_headers: &[(String, String)],
_origin: Option<&str>,
) -> Result<Response, NetError>
pub async fn fetch_get( &self, url: &str, extra_headers: &[(String, String)], _origin: Option<&str>, ) -> Result<Response, NetError>
Fetch-API-style GET with accept: */* semantics.
Sourcepub async fn fetch_post_bytes(
&self,
url: &str,
body: &[u8],
extra_headers: &[(String, String)],
_origin: Option<&str>,
) -> Result<Response, NetError>
pub async fn fetch_post_bytes( &self, url: &str, body: &[u8], extra_headers: &[(String, String)], _origin: Option<&str>, ) -> Result<Response, NetError>
Fetch-API-style POST with raw bytes.
Sourcepub async fn post(&self, url: &str, body: &str) -> Result<Response, NetError>
pub async fn post(&self, url: &str, body: &str) -> Result<Response, NetError>
Perform a POST request with a string body.
Sourcepub async fn post_with_headers(
&self,
url: &str,
body: &str,
extra_headers: &[(String, String)],
) -> Result<Response, NetError>
pub async fn post_with_headers( &self, url: &str, body: &str, extra_headers: &[(String, String)], ) -> Result<Response, NetError>
POST with extra headers.
Sourcepub async fn post_bytes_with_headers(
&self,
url: &str,
body: &[u8],
extra_headers: &[(String, String)],
) -> Result<Response, NetError>
pub async fn post_bytes_with_headers( &self, url: &str, body: &[u8], extra_headers: &[(String, String)], ) -> Result<Response, NetError>
POST with raw bytes and extra headers.
Sourcepub async fn get_follow(
&self,
url: &str,
max_redirects: u8,
) -> Result<Response, NetError>
pub async fn get_follow( &self, url: &str, max_redirects: u8, ) -> Result<Response, NetError>
GET with explicit redirect following.
Sourcepub async fn get_follow_with_headers(
&self,
url: &str,
extra_headers: &[(String, String)],
max_redirects: u8,
) -> Result<Response, NetError>
pub async fn get_follow_with_headers( &self, url: &str, extra_headers: &[(String, String)], max_redirects: u8, ) -> Result<Response, NetError>
GET with extra headers and redirect following.
Sourcepub async fn post_follow(
&self,
url: &str,
body: &str,
max_redirects: u8,
) -> Result<Response, NetError>
pub async fn post_follow( &self, url: &str, body: &str, max_redirects: u8, ) -> Result<Response, NetError>
POST with redirect following. 307/308 preserve the body.
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 (const: unstable) · 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 !UnwindSafe 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